I'm trying to figure out, how to read EEprom values directly into variables, which are dedicated to specific cells of the EE.
This is for a universal way to read all stored values in the EE into dedicated variables, e.g. at the start of main, no matter what types (uint8_t, uint16_t, uint32_t) they are.
I remember, I've seen such a way before which worked fine, but I think there is something missing here....
An example, to make more clear, what I'm trying to do:
The variable _length should have 2 byte (= uint16_t) Now I would define: uint8_t _lenght; // variable and uint8_t EEval; // values of a single EE-cell The values for _length and _length are stored in the EE (=HB) and EE (=LB). and defining uint8_t *VarName_ptr; // pointer to a variables name and assigning the VarName_ptr to the variable: VarName_ptr = _lenght; // pointer to the variable _length EEval = eeprom_read_byte((uint8_t*) 50); // value = 0x80 (=HB) EEval = eeprom_read_byte((uint8_t*) 51); // value = 0xFB (=LB) now assigning VarName_ptr  = EEval; VarName_ptr  = EEval; I'd like to see _length now as 0x80FB, so I can 'use' it as uint16_t. But the value shows up as 0x8FA ,using sprintf (StrDisplay, "Length: %x", _length); lcd_sendString(StrDisplay);
Any ideas, what I'm doing wrong?