Presentation is loading. Please wait.

Presentation is loading. Please wait.

OOPic (Object Oriented Pic) Dominick D’Aniello Jacques Bosman.

Similar presentations


Presentation on theme: "OOPic (Object Oriented Pic) Dominick D’Aniello Jacques Bosman."— Presentation transcript:

1 OOPic (Object Oriented Pic) Dominick D’Aniello Jacques Bosman

2 Overview What is the OOPic? What Makes the OOPic Different? – Hardware Objects – Virtual circuits – Events The OOPic IDE The OOPic Language Demo

3 What is the OOPic? OOPic is an object oriented operating system (and hardware circuit) Programmed in a Basic like or Java/C++ style language Capable of inter-OOPic communications

4 What makes the OOPic different? Physically, the OOPic is nothing more than a Microchip™ Pic microcontroller slapped on a circuit board with some EEPROM and a few pin headers for easy access to the Pic’s pins. What makes the OOPic unique is the software it runs. The OOPic software allows one to interact with physical hardware, as if it were a OOP software object. +=

5 Hardware Objects OOPic offers many pre-made “Hardware objects” that provide software mappings to real world hardware. Objects include something as simple as 1 bit digital IO (An LED or a switch) to something as non trivial as an LCD or a stepper motor. Allows for intuitive statements such as: LCD.Operate = 1 ' Turn on the oLCD Object. LCD.Init ' Initialize the LCD Module. LCD.Clear ' Clear the screen. LCD.Locate(0,1) ' Locate cursor at row1, col2. LCD.String = "Hello World" ' Print "Hello World" on LCD.

6 Virtual Circuits OOPic allows you to create multiple “Virtual circuits” that run independently of each other and your running code. Dim Button1 As New oDIO1 Dim Button2 As New oDIO1 Dim RedLed As New oDIO1 Dim AndGate As New oGate(2) Button1.IOLine = 1: Button1.Direction = cvInput Button2.IOLine = 2: Button2.Direction = cvInput RedLed.IOLine = 3: RedLed.Direction = cvOutput AndGate.Input1.Link(Button1.Value) AndGate.Input2.Link(Button2.Value) AndGate.Output.Link(RedLed.Value)

7 Events The OOPic supports events (interrupts) through the oEvent object Event is triggered when the oEvent objects operate value goes from 0 to 1. When the even is triggered the procedure with the same name as the event, followed by “_code” is executed, for example if you have an oEvent object named “bump”, then the procedure named “bump_code” would execute when bump.operate = 1. Events can have different priorities (lower priorities have precedence) Events interrupt current program flow, when they return, program flow resumes where it left off.

8 The OOPic IDE The OOpic IDE offers simple editing, flashing, and debugging features. Code is shown on the left, objects represented in the code are shown on the right. When the OOPic is connected to the computer you can click on any of the objects in the right hand panel to view and manipulate their current state.

9 The OOPic IDE (Cont)

10 The OOPic Languages The OOPic offers 3 basic language modes (Basic and Java/C++ style). The BASIC style is fairly true to traditional BASIC syntax, however the Java/C++ style is only very loosely related to actual Java and C++ syntax (Basically it has ;’s) Java and C++ languages types are technically treated differently, but VERY few differences exist.

11 The OOPic Languages (cont) Supports all basic loop and control structures (If/then/else, switch, for, do/while) Procedures support recursion (limited only by stack space) Supports arrays of any object type (Arrays are indexed starting at 1, not 0) Supports user defined objects

12 The OOPic Languages (cont) Dim A As New oDio1 Sub Main() A.IOLine = 31 A.Direction = cvOutput Call Blink End Sub Sub Blink() A.Value = cvON OOPic.Wait = 100 A.Value = cvOff OOPic.Wait = 100 End Sub BASIC Java/C++ oDio1 A = New oDio1; Sub void main(void) { A.IOLine = 31; A.Direction = cvOutput; Blink(); } Sub void Blink(void) { A.Value = cvON; OOPic.Wait = 100; A.Value = cvOff; OOPic.Wait = 100; }

13 Demo 1. oDio1 LED[8] = New oDio1; 2. oWire wires[4] = New oWire; 3. Sub void Main(void) 4. { 5. OOPic.Node = 2; 6. oByte I = New oByte; 7. 8. for (I.Value = 1; I.Value <= 8; I.Value++) 9. { 10. LED[I.Value].IOLine = (I.Value + 7); 11. LED[I.Value].Direction = cvOutput; 12. LED[I.Value].set; 13. } 14. wires[1].Input.Link(OOPic.Hz1); 15. wires[1].Output.Link(LED[5]); 16. wires[1].InvertIn = cvFalse; 17. wires[1].Operate = cvTrue; 18. wires[2].Input.Link(OOPic.Hz1); 19. wires[2].Output.Link(LED[6]); 20. wires[2].InvertIn = cvTrue;

14 Demo 21. wires[2].Operate = cvTrue; 22. wires[3].Input.Link(OOPic.Hz1); 23. wires[3].Output.Link(LED[7]); 24. wires[3].InvertIn = cvFalse; 25. wires[3].Operate = cvTrue; 26. wires[4].Input.Link(OOPic.Hz1); 27. wires[4].Output.Link(LED[8]); 28. wires[4].InvertIn = cvTrue; 29. wires[4].Operate = cvTrue; 30. Do 31. { 32. for (I.Value = 1; I.Value <= 4; I.Value++) 33. { 34. LED[I.Value].value = 0; 35. OOPic.delay = 20; 36. LED[I.Value].value = 1; 37. OOPic.delay = 20; 38. } 39. } while (1); 40. }


Download ppt "OOPic (Object Oriented Pic) Dominick D’Aniello Jacques Bosman."

Similar presentations


Ads by Google