Hi All,
Resolved this with a simple funtion splitting the value in byte long parts. Bit shifting and OR are a perfect fit for this :-).
The code:
void storeEeprom(int pos, int value) {
// function for saving the values to the internal EEPROM
// value = the value to be stored (as int)
// pos = the first byte position to store the value in
// only two bytes can be stored with this function (max 32.767)
gw.saveState(pos, ((unsigned int)value >> 8 ));
pos++;
gw.saveState(pos, (value & 0xff));
}
int readEeprom(int pos) {
// function for reading the values from the internal EEPROM
// pos = the first byte position to read the value from
int hiByte;
int loByte;
hiByte = gw.loadState(pos) << 8;
pos++;
loByte = gw.loadState(pos);
return (hiByte | loByte);
}