retrieve eeprom address
Marz Krishna
Posts: 26
is there a way to retrieve the adress of an eeprom variable
eg.
mydata data @10, "My good data"
retrieveaddr var word
retrieveaddr = @mydata
eg.
mydata data @10, "My good data"
retrieveaddr var word
retrieveaddr = @mydata
Comments
If so,
fetches the contents of address 100, placing it in·your VAR retrieveaddr.
That's covered in·PBASIC Help.
eg.
if i have a Data var X at location 100, and i want to move it to location 107 and still be able to use the "x" symbol to access the data..
X var word
X = MyData ' X now equals 10
The BS2 is very simple. It only HAS 2000 bytes of eeprom to store stuff in. When you say "MyData DATA @10 "whatever" ", 'MyData' IS a 'pointer' to the EEPROM location holding the 'w'. Meaning MyData IS the value 10, which IS the location in eeprom of your data. Note "MyData" is a compile-time label -- meaning it doesn't take up space in memory.
So:
MsgOne DATA "My Goodness",0 ' Putting a zero between strings lets the 'STR' modifier stop at the right place
MsgTwo DATA "Hello again",0
X = MsgOne
SEROUT 16, 16864, (STR X) ' Sends "My Goodness"
X = MsgTwo
SEROUT 16, 16864, (STR X) ' Sends "Hello again"
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
I recently did a project were I had lots of variable-string data to store. To keep it organized I used a large external EEPROM, and assigned my strings to large intervals in the memory. Wasting a lot of space but keeping things organized, I was able to reference things without messing up my code with lots of random pointers. The pointers had values in 100 byte intervals.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Don't worry. Be happy
What you describe can probably be done with an auxiliary table in EEPROM that your program has to manage.
Msg1pointer DATA 10
Msg2pointer DATA 15
MsgZpointer DATA 20
Msg1 @10 DATA "Dogs", 0 ' going to change this to "Beagles"
Msg2 @15 DATA "Cats", 0
endofMessages DATA, 20
If the program needed to change the entry "Dogs" to "Beagles", it would move everything else up by three bytes, overwrite the old entry with the new one, then update all the pointers. This is a pain, especially since it is all in EEPROM. The technique using an external eeprom or a Stamp like the BS2pe, with fixed addresses and enough bytes at each address to store even the longest entry, that would be much easier to manage.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tracy Allen
www.emesystems.com