Hey y'all! Probably this was already answered in another way or in another topic, but i couldn't find nothing related to this here. (maybe i wasn't looking in the right place, anyway), I'm working on a MIDi controlled foot switch, and in this project, i have an array that saves the value of the output (HIGH or LOW, works with 1 or 0 also) for 48 different patches. The values for the patches are already declared on the array, but can be modified when the program is running.
When I shut the power down, i loose every change made to that array, having it back to the declaration values on the code when i turn it on again.
I got a MicroSD module here, and tried some options, writing it to a TXT file and then reading back again, but until now is not working as expected. I can write it but can't read it back and store it.
I'd like to know if there's a better way of doing this, maybe without de SD card. I know that i can write it in the EEPROM, but i'm afraid that i'll exceed 100.000 writes, once the code automatically saves the configuration after each patch change, so i'm afraid this may not be the best way.
Where would you store it??
The bigger question is how much hardware do you have?
In most of My projects I include a RTCC, most have at least 64bytes of battery backed RAM included. This RAM has an infinite number of rewrites possible. So I could store your 48 bits of data into 6 bytes. The value of the RAM is saved until the battery fails, (3yrs).
I usually also include a 24LC512 EEPROM (64k bytes) for long term storage(MicroChip states, over 1 million erase/write cycles, and data retention of over 200 years), this EEPROM can be modified approximately one million times. Since this chip has 64k of space, an you are worried about wearing out memory cells, use a two step process. Use the first two bytes as an pointer to where your 6 byte patch table is stored. every time you power up, read the last patch table, increment the storage location. Every time you change the value of your patch table write it to the current storage location. Every power cycle will use a 'new' block. Whenever your device powers up, it will be as if a new memory chip has been installed. after 10k power cycles you will start reusing the 'old' locations. But, I highly doubt that you will use any single block a million times?
So this method would allow 10,000 * 1,000,000 patch modifications before the minimum device endurance would be exceeded. So if you modified your patch table once every second, it would take you 317 years to wear out the EEPROM.