Skip to main content
14 events
when toggle format what by license comment
Aug 9, 2016 at 20:19 comment added Ale @dwelch For applications that intensively write to non-volatile memory, this might make sense, either with a SD card or similar memory support, or even an EEPROM on a DIL socket (depending on the application, one or the other might make more sense). However, one has to check what the possible lifetime of the EEPROM will be: supposing that the program writes to the EEPROM every hour at the same address, the PIC18F EEPROM will still have a lifetime of 114 years before reaching its EOL. Compare with the 40 years data retention of its Flash before needing to "refresh" it...
Aug 6, 2016 at 8:16 vote accept S Andrew
Aug 5, 2016 at 20:12 comment added old_timer you could use an sd card (something removable) for this, save early and often, when it wears out give them a corrupt card message and they can buy a new sd card to keep it working.
Aug 5, 2016 at 20:11 comment added old_timer Ideally you only want to save on a power down to avoid wearing out the non volatile storage, do that right though you need hardware to detect the power is going down, and enough capacitance or other energy storage to guarantee to stay up long enough to complete the write.
Aug 5, 2016 at 14:45 comment added Ale @Makyen Good considerations, thanks! I expanded the answer.
Aug 5, 2016 at 14:44 history edited Ale CC BY-SA 3.0
more precisions, rephrased
Aug 5, 2016 at 14:35 history edited Ale CC BY-SA 3.0
added precision about write cycles
Aug 5, 2016 at 10:10 comment added pjc50 Microcontrollers tend to have static RAM and capacitors on board, so they can often retain values across short periods of power-off.
Aug 5, 2016 at 9:29 comment added S Andrew @Ale Thanks. This is great. I studied about memory management and tried this code and its working. Before merging this code to my existing GSM code, I tested my code for the GSM. I power off the MCU and turned it on again and it was working. The defined variables are even working after power off. Now this has created a huge confusion in my mind. How the variable are working after power off. How the data in the variables are still safe.?
Aug 4, 2016 at 15:08 comment added Makyen Even though the EEPROM in the PIC18F2520 has a 1M erase/write cycle spec, it might be a good idea to mention that issue. You might cover it briefly or point to other questions/resources which cover mitigating the number of times the EEPROM is written (e.g. only writing upon detection of loss of power, wear leveling, etc.). While it might not be needed in the OPs specific situation, it would be helpful for people seeing this Q&A in the future to at least have mentioned that there are additional considerations other than thinking they should store some random variable in EEPROM/FLASH.
Aug 4, 2016 at 15:03 comment added CHendrix If you don't have EEPROM available, most micros (all of the ones I've run across) will let the firmware write to flash. It's not as fast, easy, or power-friendly as EEPROM, but it can be done. If you have EEPROM, that's definitely the way to go.
Aug 4, 2016 at 13:24 history edited Ale CC BY-SA 3.0
rephrased
Aug 4, 2016 at 13:09 history edited Ale CC BY-SA 3.0
clarified
Aug 4, 2016 at 13:03 history answered Ale CC BY-SA 3.0