View Full Version : Common Variable
Big Mike
07-07-2009, 03:06 AM
I am looking for a way to access variables between the upper program and the variables set out in the objects in that program.· I would like to have a number of variables defined in the top level of the program and then have an object access that data and to have the object write data to some of the variables defined in the upper program. Is there a way of accessing that or will I have to copy the information to and from·that object's variable area.· Any help you can provide is appreciated
·
Thanks: Mike
·
·
Use pointers.
Just pass the variable addresses to the lower level objects.
The use word[address] or byte[address] or long[address] to set or read the variable.
Like...
VAR
byte stuff1
word stuff2
long stuff3
PUB writeStuff
byte[@stuff1] := 128
word[@stuff2] := 32768
long[@stuff3] := 1231231231
PUB readStuff1
return byte[@stuff1]
PUB readStuff2
return word[@stuff2]
PUB readStuff3
return long[@stuff3]
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Nyamekye,
Post Edited (Kye) : 7/6/2009 8:24:08 PM GMT
Big Mike
07-07-2009, 03:41 AM
My isue was i needed to know the locaion of a certain variable to use as a reference for an index but what you said made me think of doing it a different way and it worked so thanks.