AnsweredAssumed Answered

S12G128 Writing Struct to EEPROM

Question asked by Ray Hall on Jul 12, 2015
Latest reply on Jul 14, 2015 by Radek Sestak

If I use this code, which is from the EEPROM example for the S12G128, the values in buf are written to EEPROM correctly.


#define EEPROM_START    0x000400


byte err;

word buf[4] = {0xAABB, 0xCCDD, 0x1122, 0x3344};


err = EEPROM_Program(EEPROM_START, buf, 4);



When I try to write my structure to EEPROM it does not write anything. This is my method.


struct StructData {

   byte startChar;

   byte packetSize;

   byte packetId;

   byte freq;

   byte frame1Enabled;

   byte frame2Enabled;

   byte frame3Enabled;

   word idEgt1to4;

   word idEgt5to8;

   word idVoltInput;

   byte setupMode;

}data;   // 14 bytes or 7 words


unsigned int size = sizeof(data) / 2;


err = EEPROM_Program(EEPROM_START, (word *)&data, size);



What am I missing