Write to and later read from EEPROM
Spoppe
Posts: 3
Building a data logger. One program measures data and writes it to EEPROM. Another program later reads the data from the EEPROM. Using Word vars. but the program that reads always gets zeroes for the high byte. Low byte is ok. What is going on? How can i read the data correctly? I have confirmed that the writing program can immediately read the data correctly. This is on BS2.
Comments
Remember that you need the WORD prefix to read and write words like: WRITE <address>, WORD <data>
Remember also that, if you're using WORD, that the addresses should increment by two.
Here is some output:
cyclecount = 10283
memory location 0 memory contents 10283
cyclecount = 10282
memory location 1 memory contents 10282
cyclecount = 10283
memory location 2 memory contents 10283
cyclecount = 10282
memory location 3 memory contents 10282
cyclecount = 10280
memory location 4 memory contents 10280
cyclecount = 10283
memory location 5 memory contents 10283
cyclecount = 10281
memory location 6 memory contents 10281
cyclecount = 10282
memory location 7 memory contents 10282
cyclecount = 10283
memory location 8 memory contents 10283
cyclecount = 10283
memory location 9 memory contents 10283
cyclecount = 10283
memory location 10 memory contents 10283
memory location 0 memory contents 10795
memory location 1 memory contents 11050
memory location 2 memory contents 10795
memory location 3 memory contents 10282
memory location 4 memory contents 11048
memory location 5 memory contents 10539
memory location 6 memory contents 10793
memory location 7 memory contents 11050
memory location 8 memory contents 11051
memory location 9 memory contents 11051
memory location 10 memory contents 10283
Steve
You have to divide that WORD into two BYTEs and WRITE them into two registers.
Same goes with READ.
READ memloc, word memcontent
WRITE memloc, word memcontent
You have to do
memloc = memloc + 2