BS2 Serin String in to EEPROM to save when power off.
Jeff_5_
Posts: 36
I have a basic stamp program i wrote that reads in three differnt strings. Word1, Word2, Word3.
Here is my serin statement. SERIN 1,84,[ STR Word1\4]
DEBUG STR Word1, CR
I have one of these for all three variables Once i read in all three i run a comparison program and some leds. Anyway my program works good except every time the basic stamp loses power i have to reread in Word1,Word2,Word3.
So how can i Serin Write to EEPROM so when powered off they will be saved.
Here is my serin statement. SERIN 1,84,[ STR Word1\4]
DEBUG STR Word1, CR
I have one of these for all three variables Once i read in all three i run a comparison program and some leds. Anyway my program works good except every time the basic stamp loses power i have to reread in Word1,Word2,Word3.
So how can i Serin Write to EEPROM so when powered off they will be saved.
Comments
Yes my Array is declared as Word1 VAR Byte(4)
Your saying i should do this
SERIN 1,84,[ STR Word1\4]
then
WRITE 0,Word1(0)
WRITE 1,Word1(1)
WRITE 2,Word1(2)
WRITE 3,Word1(3)
That will write them to the EEPROM
To get the back out the do my comparison i need to
READ 0,Word1(0)
READ 1,Word1(1)
READ 2,Word1(2)
READ 3,Word1(3)
Then i can do my compassion.
IF ((Word1(0)=Word(0)) AND (Word(1)=Word2(1)) and so on....
Of course i would do the WRITE and READ statements for all three Arrays. Word1, Word2, Word3
This should work correct?
One more question. If i read from EEPROM every time i do my compassion wont that slow my program down alot? I do this comparison probably 100 times a minute. I really just need to read from EEPROM on startup not every time.
It seems to me in your code that you're not writing out Word values, but rather single byte values. Is this what you intended? If indeed there are Word values in your array then when the first WRITE executes data is writen to locations 0 and 1. However in your second WRITE statement you will overwrite location 1. You need to increase your addresses by two when writing Word values (2 bytes).