This Forum is Dedicated For all The Object Oriented PIC Lovers .......... The concept behind OOPic is straight forward. Use preprogrammed multitasking Objects from a library of highly optimized Objects to do all the work of interacting with the hardware. Then write small scripts in Basic, C, or Java syntax styles to control the Objects. During operation, the Objects run continuously and simultaneously in the background while the scripts run in the foreground telling the objects what to do.

Friday, March 21, 2008

[oopic] Events on C.1.1 & C.1.1+ Firmware - WORK AROUND!!

Hello all,
I have been working on the RAM workaround that was previously
mentioned and have been able to make the oEvent object work correctly
in my program. I thought that I would share this with you. You have
to be able to look at the compiled code in order to make them work.
The problem is that when the oEvent object is declared, the compiler
does not fill in the pointer for the code address. In order to make
them work, you have to go back and fill in what the compiler left
out. After you write your program how you would normally, declare an
oRAM object and you first several lines in the Main subroutine will
be used to setup the event pointer. Here is an example:

---

Dim Test As oEvent
Dim Test_Wire As oWire
Dim LED As oDIO1

Dim RAM_Access As oRAM

Const Event_Obj_Location = 41 ' oEvent "Test" memory location
Const TestCode_Location_Hi = 0 ' Test_Code EEPROM location High
Const TestCode_Location_Lo = 67 ' Test_Code EEPROM location Low

Sub Main()
RAM_Access.Location = Event_Obj_Location
RAM_Access.Value = 8 ' The oEvent object class
RAM_Access.Location = Event_Obj_Location + 1
RAM_Access.Value = TestCode_Location_Lo
RAM_Access.Location = Event_Obj_Location + 2
RAM_Access.Value = TestCode_Location_Hi

Test_Wire.Input.Link(ooPIC.Hz1)
Test_Wire.Output.Link(Test.Operate)
Test_Wire.Operate = cvTrue

LED.IOLine = 26
LED.Direction = cvOutput
End Sub

Sub Test_Code()
' This code simply swaps the state of an IO Line
LED.Invert
End Sub

---

For the constants, you will have to fill in these values.
Event_Object_Location will be the memory location where the event is
initialized. TestCode_Location_Lo will be the low byte of the EEPROM
address for the oEvent object code. TestCode_Location_Hi will be the
high byte of the EEPROM address for the oEvent object code. Once you
have the address, the high byte = Address / 256 (no decimal places,
no rounding) and the low byte will be the remainder (Address Mod
256). The only way that I know to get these is to compile the code
and look through the compiled code for the first line under the "LXX:
Proc.Begin ;This.Test_Code" so you will have to put in fake numbers
first (anything between 0 and 255 should be OK). Once you have
placed those values into the constants, compile again and check to
make sure that nothing has changed. Unless you added or removed some
code, everything should be just fine. Send the code to your OOPic
and you are good to go...Hopefully!


------------------------------------

Yahoo! Groups Links

<*> To visit your group on the web, go to:

http://groups.yahoo.com/group/oopic/

<*> Your email settings:
Individual Email | Traditional

<*> To change settings online go to:

http://groups.yahoo.com/group/oopic/join

(Yahoo! ID required)

<*> To change settings via email:
mailto:oopic-digest@yahoogroups.com
mailto:oopic-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
oopic-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:

http://docs.yahoo.com/info/terms/

No comments: