jeremiah
Joined: 20 Jul 2010 Posts: 1354
|
|
Posted: Sat May 23, 2015 7:42 am |
|
|
300 is not an int8 value (0-255 are int8 values).
You either need to use an int16 value and split it/merge it:
Code: |
unsigned int16 value = 300;
unsigned int16 result = 0;
write_eeprom(0x00,make8(value,1));
write_eeprom(0x01,make8(value,0));
result = make16(read_eeprom(0x00),
read_eeprom(0x01));
|
or if the compiler has pointer/length write_eeprom and read_eeprom support for your chip:
Code: |
unsigned int16 value = 300;
unsigned int16 result = 0;
write_eeprom(0x00,&value,sizeof(unsigned int16));
read_eeprom(0x00,&result,sizeof(unsigned int16));
|
|
|