I would like to store some values in EEPROM, and then read these out later when I need them.. The problem is what I I2CWRITE is not what I see when I I2Cread... Where I THINK I store a '1', I see it read back as '127' or '80'...???
Consider this - I want to store a baud rate for SERIN2 - a value of "16572".
So, I create a varable:
WBD var Word ' variable to be stored
LOC_WBD = 20 ' memory location to store it
Then I write the value to EEPROM
Assume: WBD = 16572, then ->
I2CWrite DPIN, CPIN, CHIP1, LOC_WBD, WBD.byte0
pause 10
I2CWrite DPIN, CPIN, CHIP1, LOC_WBD+1, WBD.byte1
pause 10
-> I'd EXPECT I just stored the variable 16572 into memory location 20 and 21 (Word)
THEN to get it back, I'd :
I2Cread DPIN, CPIN, CHIP1, LOC_WBD, WBD.byte0
I2Cread DPIN, CPIN, CHIP1, LOC_WBD+1, WBD.byte1
WBD should be 16572... but it is not. What did I miss?
Same goes for BYTE sized storage of varables..
B0 = 1
LOC_B0 = 22
I2CWrite DPIN, CPIN, CHIP1, LOC_BO, B0
pause 10
( I think I stored '1' in memory location 22)
BUT:
I2Cread DPIN, CPIN, CHIP1, LOC_BO, B0
LCDout "BO is: ",#BO
Displays 127 or 80 - not '1'...
I am missing something FUNDAMENTAL here..
Tom
Bookmarks