//
#include <avr/eeprom.h>
// defines for eeprom access
#define read_eeprom_byte(address) eeprom_read_byte ((const uint8_t*)address)
#define write_eeprom_byte(address,value) eeprom_write_byte ((uint8_t*)address,(uint8_t)value)
#define read_eeprom_word(address) eeprom_read_word ((const uint16_t*)address)
#define write_eeprom_word(address,value) eeprom_write_word ((uint16_t*)address,(uint16_t)value)
#define read_eeprom_dword(address) eeprom_read_dword ((const uint32_t*)address)
#define write_eeprom_dword(address,value) eeprom_write_dword ((uint32_t*)address,(uint32_t)value)
#define read_eeprom_array(address,value_p,length) eeprom_read_block ((void *)value_p, (const void *)address, length)
#define write_eeprom_array(address,value_p,length) eeprom_write_block ((const void *)value_p, (void *)address, length)
uint8_t EEMEM eeprombyte=0x10; [COLOR="red"]//store initial byte to eeprom, eep file will include this[/COLOR]
uint16_t EEMEM eepromword=0x5555; [COLOR="red"]//store initial word to eeprom, eep file will include this[/COLOR]
uint8_t EEMEM eepromstring[5]={"Test\0"}; [COLOR="red"]//store string to eeprom, eep file will include this[/COLOR]
int main(void)
{
uint8_t RAMbyte; //RAM byte variable
uint16_t RAMword; //RAM word variable
uint8_t RAMstring[5]; //RAM array of bytes
RAMbyte = read_eeprom_byte(&eeprombyte); //read byte from EEPROM and store to RAM
RAMword = read_eeprom_word(&eepromword); //read word from EEPROM and store to RAM
read_eeprom_array(eepromstring,RAMstring,5); //copy string from EEPROM to RAM
}