I look for a simple way to save and restore program variables in the EEPROM of the controller (in my case a atmega328).
I have some different byte and word variables wich I want save in a for loop to the EEPROM and read back after power off/on.
Array variables are not a option for me.
If all variables were in an order then I could read by peek and save the value in the EEPROM, but how can I archieve this and how can I get the start and end of this variable area.
Has anybody an idea?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Keep the values all the same type , so all word values. Then set a unique flag value (like wordVal_H = 0x55, wordVal = 0xAA ?) after the end of the for loop, so that you know you have reached the end when you read them back from the eeprom. Use a similar flag, before the for loop, if a required start value is needed.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello maybe someone can help me or give me a tip,
I look for a simple way to save and restore program variables in the EEPROM of the controller (in my case a atmega328).
I have some different byte and word variables wich I want save in a for loop to the EEPROM and read back after power off/on.
Array variables are not a option for me.
If all variables were in an order then I could read by peek and save the value in the EEPROM, but how can I archieve this and how can I get the start and end of this variable area.
Has anybody an idea?
Keep the values all the same type , so all word values. Then set a unique flag value (like wordVal_H = 0x55, wordVal = 0xAA ?) after the end of the for loop, so that you know you have reached the end when you read them back from the eeprom. Use a similar flag, before the for loop, if a required start value is needed.