Well, like everthing else, there's probably 100 different ways to go about it. And the best way depends on how your program needs to use it.
But the biggest thing to remember is that you can only READ 1 byte at a time. So, to read a WORD value must be done in 2 operations.
If you wanted to read the data into an array of WORDS, you could do this...Code:READ 1, wordvar.LowByte READ 2, wordvar.HighByteIf you just want to read individual words, then you'll need to know where they are located in EEPROM. You could just count bytes in the data and use the starting address as the location for the READ. But as the program changes, the data might change too, and all those locations you counted fly out the window.Code:ArraySize CON 4 WordArray VAR WORD[ArraySize] Ptr VAR BYTE DataStart VAR BYTE DataStart = 1 For Ptr = 0 to (ArraySize * 2) -1 READ DataStart + Ptr, WordArray.LowByte(Ptr) Next Ptr
So the easiest way to deal with individual Locations is to give them names in the DATA statement. Then when things change, the pointers to the data change too.
Well, that's 3 possibles, at least 97 more available.Code:Calibration DATA @1, WORD $1DF4 Offset DATA WORD $FAFD Something DATA WORD $AB13 Another DATA WORD $3FC3 READ Something, wordvar.LowByte READ Something + 1, wordvar.HighByte ; returns $AB13 READ Calibration, wordvar.LowByte READ Calibration + 1, wordvar.HighByte ; returns $1DF4
HTH,





Bookmarks