I’m using some solar cells to charge a lithium-ion battery… I have a pro mini (ATMega328 3.3V) and want to use it to periodically record the battery voltage. I want to write the data to the ATMega328’s on-board flash memory (because it’s 32kB, while EEPROM is only 1kB).
However, I came across this statement on the Arduino Playground page that describes memory:
“Note: Flash (PROGMEM) memory can only be populated at program burn time. You can’t change the values in the flash after the program has started running.”
So is this correct? i.e. code running on the ATMega328 cannot write data to its own flash memory?
If code running on the ATMega328 CAN actually write to its own flash memory, how do I go about doing this?
- I’ve read about the PROGMEM function
Also, how is data arranged when it is being written to flash memory? i.e. If I write a few bytes to flash memory, and then several minutes later write another few bytes, is the data stored contiguously at the next available memory address? Do I have to keep track of used/available memory addresses and specify that the data being written is put at an address that I know is empty?
I’m a little confused by all this, so I’d appreciate any light that can be shone on the situatiion!