Problem while Writing into EEPROM of Boe-Bot
heavy-freelancer
Posts: 23
Hey,
I have to remember a value of some variables when running my program.
So I've looked into the BASIC Stamp Manual v2.2, and found some instructions that may help.
I've created 2 programs. the first to write to EEPROM, and the other to read from it, like shown here :
1st program:
DATA @10, 55
2nd program:
myCounter VAR Word
READ 11, myCounter
DEBUG DEC myCounter
This is working great, but I want to do this in the 1st program :
Temp VAR Word
Temp = 44
DATA @10, Temp
The compiler is giving me an ERROR here.
Because I'm using many instruction in my program, I need to store the value of the variable in the adresse @10 instead.
Do you have any ideas.
Thanks
I have to remember a value of some variables when running my program.
So I've looked into the BASIC Stamp Manual v2.2, and found some instructions that may help.
I've created 2 programs. the first to write to EEPROM, and the other to read from it, like shown here :
1st program:
DATA @10, 55
2nd program:
myCounter VAR Word
READ 11, myCounter
DEBUG DEC myCounter
This is working great, but I want to do this in the 1st program :
Temp VAR Word
Temp = 44
DATA @10, Temp
The compiler is giving me an ERROR here.
Because I'm using many instruction in my program, I need to store the value of the variable in the adresse @10 instead.
Do you have any ideas.
Thanks
Comments
DATA & WRITE are the same Mike G ?
Sorry, I mean 11:
1st program:
Temp VAR Word
Temp = 44
DATA @11, Temp 'How can I send to value of Temp here ?
2nd program:
myCounter VAR Word
READ 11, myCounter
DEBUG DEC myCounter
Look at the description of the DATA, READ, and WRITE statements in the Stamp Manual or the Stamp Editor's help files.
Ok, I get it now.
I don't have the robot with me right now to test, but how can write the value of Temp in the adresse @10, Is this code going to work ?
1st program:
Temp VAR Word
Temp = 44
WRITE @11, Temp
2nd program:
myCounter VAR Word
READ 11, myCounter
DEBUG DEC myCounter
I don't understand really what this sentence mean : The WRITE command normally only stores byte-sized values into EEPROM.
I'm using PBasic 2.5 with BS2.
I understand almost everything about the WRITE and READ commands.
For example :
value VAR Word
WRITE 1, Word 2000
READ 1, Word value
DEBUG DEC value
But I still can't know how to return the value of another variable to the WRITE command. Like :
myValueVAR Word
myValue = 2000
WRITE 1, Word 2000 'How can I change 2000 by something to return the value of myValue