SAVE_EEP8 data, addr8   

* Available on PLC with >= r78 firmware only

Purpose This command  stores an 8-bit integer data in the user’s definable EEPROM or FRAM address "addr8"   for non-volatile storage. The actual PLC may have less EEPROM space. Please refer to your PLC’s reference manual for the upper limit. 

If data  is 16 or 32-bit then only the lowest 8-bit of the data will be saved.

data - may be a any integer constant or variable.

addr8 - byte address of the EEPROM/FRAM space for data storage.


Byte, Word and Long Word Addressing:   Note that the EEPROM space for 8-bit, 16-bit and 32-bit SAVE_EEPXX and LOAD_EEPXX command are the same space and they are mapped as shown below

SAVE_EEP32 SAVE_EEP16 SAVE_EEP8
1 1 and 2 1, 2 3 & 4
2 3 and 4 5,6,7,8
... .. ..
N 2N-1 & 2N 4N-3, 4N-2, 4N-1, 4N

If you intend to use the EEPROM/FRAM space to store more than 1 type (8, 16 or 32-bit) of data then you must properly manage the EEPROM/FRAM data space reserved for storing each type of data  so that they don't overwrite each other address space.  The easiest way is always to reserve enough space for 32-bit data, followed by space reserved for 16-bit and/or 8 bit data.

E.g. If you have 6000 words (16-bit) of FRAM space - this means you have space for storing 6000*2 = 12000 bytes of 8-bit data and you only have 6000/2 = 3000 long words for storing 32-bit data.

Now assume that your program needs to store up to 500 x 32-bit data and the balance for storing 8 bit data.

If you reserve 500 long words for 32-bit data, that means you are using up 500*4 = 2000 bytes of the FRAM space. This leaves you 12000 - 2000 = 10000 bytes of FRAM space for storing 8-bit data starting from byte address space 2001 to 12000.

Examples save_EEP8 relay[1],100
See Also LOAD_EEP( ), GETHIGH16( ), SETHIGH16, SAVE_EEP$

backbutton.gif (507 bytes)  Basic to TBASIC Reference Manual