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!
------------------------------------

(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )
If you put the event handler code first (before main and any other
subroutines/functions), its location should remain constant unless
you add/remove some objects. Give it a try.
At 10:30 PM 3/21/2008, tinslwc wrote:
>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!
------------------------------------

(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )
Working on this issue further, I have found that you can remove the
first two lines (setting the oEvent object class). That part is
fine. I have also found that using a hex editor, you can manually
insert the address into the oopic executable file (hex compiled file)
and eliminate the oRAM object entirely. After finding the address of
the subroutine, calculate the hex notation for the address, open the
source code in the V6 compiler, open the .oex file in a hex editor,
find the initial object declaration (won't be easy) and insert the
address here (low byte first), go back to the oopic program and click
the green arrow to send to oopic. Make sure you do not change any
code as it will recompile and you will lose any changes that you
made. I would recommend using the ram object over this but if you
need to do it, it will work.
--- In o...@yahoogroups.com, "tinslwc"
wrote:
>
> 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!
>
------------------------------------

(You need to be a member of oopic -- send a blank email to oopic-subscribe@yahoogroups.com )