Reading strings from the DATA Function
Hello I'm working on a code for the boe-bot where I'm using the DATA function to write to the EEPROM. Lets say I have a piece of code where I have DATA "FAST", how can I read this into the EEPROM, I tried using the read function like so READ "FAST" But I get an error that says Expected a variable is their an alternate way to Read "FAST" from DATA.e Im using the bs2 micro controller.
Comments
READ 0,C ' puts "F" into C
READ 1,C ' puts "A" into C
READ 2,C ' puts "S" into C
READ 3,C ' puts "T" into C
Frequently you'll have some special byte value that marks the end of the string you're storing. Commonly, this is a zero byte value. Let's say you want to use DEBUG to display a string starting at location 10. You might have
p = 10 ' initialize the pointer
loop:
read p, temp ' read the byte
p = p + 1 ' increment the pointer
if temp = 0 then goto exit ' check for end of string
debug temp ' display the character
goto loop
exit:
Study up on the READ command in the reference manual. There you'll see that the format of the command is:
READ Location, Variable
...where Location is the memory address of the data that you're after, and Variable is where the data will be held.
The error you received was because the command format was not syntactically correct.
Regards,
DJ
***Darn! Mr. Green beat me to it, again!