I hope that you all are well. I've setup some integers in my program to use and assigned some default values to each and have written it to my ATMega328. I've also got four push buttons and a GLCD for interfacing and I've programmed the ATMega so that I can change the integer values by means of the push buttons. The values are then stored back into the integer variable but as soon as I power off and on then the same default value is there again.
Now I've read up a bit about using your EEPROM to store the value into and then I will have to read from it every time I power up the unit to remember the changed value but I was hoping to find out whether there was another way of changing the value that is stored on the ATMega in the program itself?
I was hoping to find out whether there was another way of changing the value that is stored on the ATMega in the program itself?
No. Only the bootloader partition can write to PROGMEM and the existing bootloaders don't provide a function you can call to write data into PROGMEM.
If you read EEPROM and find a 0xFF (255 or -1) it probably means that the EEPROM has been erased (or never written). You can use that as a clue to use a default instead of the EEPROM value.
You could try to interface it with a 24LC512 or 24LC1024 (EEPROM) and read from the eeprom but you have to write to it before you power down
Thanks John for the info. That is what I needed to know. I will then just write the values I want to remember to the EEPROM and read from it from startup.