You're losing the plot before you start Vladimir...
eeprom 0, [100]
eeprom 1, [350]
eeprom 3, [1981]
eeprom 5, [1860]
eeprom 7, [1860]
eeprom 9, [1860]
eeprom 11, [1860]
As I replied to you earlier in the Private Message you can only store BYTES at a time in EEPROM. That's values 0-255 Decimal. At EEPROM address 1, you are trying to store 350, it's not going to happen. Pretend 350 is a 16-bit word, you will store the lower 8-bits into address 1, and NOTHING into address 2 (it will remain unchanged with any previous contents intact). The same at address 3 - you will store the lower 8-bits of the 16-bit value 1981, and address 4 will remain untouched.
Later on, you are reading words like this...
read 5, T2
You are expecting to have a value of 1860, but you won't. T2 will be loaded with the value from EEPROM address 5 ONLY. EEPROM address 6, (which you are expecting to load into the highbyte of T2 will NOT be read). REMEMBER that EEPROM operations work on ONE BYTE ONLY - Not Words - BYTES!
For example, let's take T2...
Initially you want to store 1860 (%0000011101000100) into locations 5 and 6, lowbyte into 5, and highbyte into 6. Do it like this...
DATA @5,%01000100
DATA %00000111
I used binary notation specifically to show you how to save a word constant (you can use the EEPROM command rather than DATA if you wish and of course you need not use Binary like I did for this explaination, you can use HEX or Decimals too).
Later on, when loading T2 do this (same technique when writing to EEPROM)...
read 5,T2.Lowbyte
read 6,T2.Highbyte
Remember BYTE AT A TIME. If you want WORDS you have to construct them out of two bytes - it will NOT be done automatically for you.
Melanie
Bookmarks