I'm doing this (on a PIC) currently -- I virtually sectioned the available EEPROM into sets of 4 bytes each, with each set holding 3 bytes of data and a checksum/validity indicator. Each save writes to the next set in sequence, looping around to the first set when necessary. On power-up, I read back all sets and use the highest valid dataset as the current one, continue counting form there, and continue saving from the set after that. The checksum is there in case only some of the bytes in a set get properly written and some fail. Cheers, -Neil. On Thursday 09 June 2005 10:50 am, David Kelly scribbled: > The classic example of what I'm thinking is an electronic odometer on a > car. One must write periodically to nonvolatile memory such as EEPROM > but limited to something like 10,000 erase/write cycles to represent > 1,000,000.0 miles. > > Have heard mention of it somewhere before but can't find/derive a > solution this morning where rather than represent every 0.1 to 1E6 in 24 > bits that writes be distributed over something like 128 bits. More like > counting days with a tally on a prison wall, only toggle one bit per > unit. Set all the bits from one end to another than start back at the > beginning and clear. > > The problem with writing my raw count to EEPROM is that to increment > from 0 to 1 is only one bit toggle, but 1 to 2 is one on one off, 3 is > only one on, 4 is one on two off. Wasteful of EEPROM wear. > > Another thought is to use Hamming codes and write multiple copies. The > AVR has way more EEPROM than I really need as I have only about 20 bytes > total of parameters, plus need for a summing register.
Message
Re: [AVR-Chat] Distributing wear on EEPROM writes?
2005-06-09 by Neil
Attachments
- No local attachments were found for this message.