Frequent writes to EEPROM of BS2 - how long it will last?
CuriousOne
Posts: 931
Hello. I'm doing a basic stamp controllable wildlife observation camera which will use several number of servos for movement, zoom and focus. I want to add a function to memorize current settings (position, focus, zoom) when power is off, so when power is applied, last settings restored. I can do this in two ways:
Simple way: As any button being released, write current settings to eeprom and read on power-up.
Harder way: Add a software "shutdown" mode, and write to eeprom only in this case.
The first way is simple to do and relatively safe in case of power failures, but eeprom may fail. The harder way needs additional hardware, may not be proof to accidential power offs, but will save the eeprom.
Which one you'd reccomend?
Simple way: As any button being released, write current settings to eeprom and read on power-up.
Harder way: Add a software "shutdown" mode, and write to eeprom only in this case.
The first way is simple to do and relatively safe in case of power failures, but eeprom may fail. The harder way needs additional hardware, may not be proof to accidential power offs, but will save the eeprom.
Which one you'd reccomend?
Comments
If the EEPROM has a lot more space than is being used, the BasicStamp can increment the address to where the EEPROM writes and snake along to a new location rather than writting over and over again to one address.
If you prepare the EEPROM before you do with with all blanks, you can search backwards to find the last entry.
And when full, the EEPROM can reformat and start all over. It is a bit more code to write, but a heck of a lot longer lasting. It is called wear leveling.
You can connect an external EEPROM to a Stamp, but it's not treated the same as the internal Stamp EEPROM and takes a bit of code to use. There are examples in the Nuts and Volts Columns. It's much easier to use READ, WRITE, and DATA.
Of course, just using an EEPROM is going to be the cheapest. And there are some tiny ones. But you can easily get larger ones for about the same cost these days.