Having been bitten by EEPROM failure on the PICs in the the past, I ended up using a serial EE and doing most of this, after discussion on and advice from this list. I also flipped bits in the copies of each byte so in case the EE all fails to a certain state, it won't be identified as valid data. -Neil. > -------- Original Message -------- > Subject: [PIC] "Best of" PIC EEPROM Algorithm Clarified > From: Bob Axtell > Date: Mon, April 24, 2006 5:08 pm > To: "Microcontroller discussion list - Public." > > Jinx wrote: > >> I believe the best overall solution is to use a "best of 3" algorithm, > >> refreshing only those cells that actually need it > >> > > > > Agree. No matter what someone says should maximise life, the > > data is what's important > > > > > To clarify, here's my "best of 3" PIC EEPROM algorithm: > > 1. When a variable is written, it is written 3 bytes in a row. It > is immediately read back to make sure all 3 bytes were written > correctly (interrupt interference, etc, happens all the time). > > 2. When a variable is needed, the set of 3 is read into a small buffer. > All three are tested to be the SAME; if all three are the same, the > variable is used and everything proceeds as usual. > > 3. If two of the three are the same but one is different, then the value of > the best two is rewritten into ALL THREE. It is then read back to make > sure all 3 bytes were written correctly. Then the variable is used. > > The best of 5 is identical except that 3 of 5 must be identical to be > accepted, > and unless all 5 are identical, all 5 are rewritten. > > I've never had a complaint since this was implemented. BTW, I never needed > best of 5, best of 3 always fixed it. > > --Bob > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist