You'll generally see these commercially as "hourmeters" or "Hobbs meters" in small aircraft, commercial trucks, and other industrial apps. As previously mentioned, there are previous threads that do a pretty good job of discussing the EEPROM storage, and it sounds like you'll have to (or should) use an external EEPROM. You should spread the data across multiple areas in the EEPROM, and on power-up, just search for the highest-valued set. But you also need to realize that since each value is 3 bytes, what happens if power is cut-off in the middle of saving a 3-byte set? Or perhaps one of 3 bytes fails? You'll notice the problem when power comes back on. Chance of this happening? Very possible, especially over 5 years. In my app, I wrote all bytes of a set all the time, but then save that same data three times to different areas of memory. On power-up, I cross-check all 3 sets to verify it's validity. Sort of like a RAID system. I also flipped some bits in some of the copies, just in case the EEPROM had some failure mode where all bits might go to ones or zeros. Another possibility would be to have a special "control" byte for each set, where you would set that to some value to indicate that that set was "dirty", then write all 3 bytes of the set, then verify the data by reading it back, and if all is okay, go ahead and mark the control byte as valid. On power-up, search for all the valid sets only. Cheers, -Neil. On Wednesday 31 May 2006 01:24, Peter Feucht wrote: > Dear PICCERs, > > I have a task, where I have to build a operation time counter, means > somethings, which adds the time a device was switched on. There is only a > 5V DC supply, if 5V is present the device works, if not, the device is > switched off. > The total time to be checked is 5 years and the resolution has to be 1 > minute. > Now first the task is very simple: When the PIC (I intend to use a 12F629) > is powered up, it reads the already elapsed time from EEPROM, then simply > starts to count minutes (by TMR1 and an added software divider) and when a > minute is over it stores the new total time into EEPROM. > Now the problem is, when calculating the total number of storages you'll > get 5 years x 365 days x 24 hours x 60 minutes = about 2,6 x 10E6 write > cycles, but the spec only says 10E6 cycles for EEPROM memory. > Further thinking showed that the result is never bigger than 3 Bytes > (FFFFF&h = 16,7 x 10E6) and the high and middle byte can be stored only, if > they have changed, so I have no more than 2,6x10E6 / 256 = about 10000 > write cycles for the middle byte and even 2,6x10E6 / 65536 = 40 write > cycles for the high byte which is inside spec. > The problem is to find a way to store 2,6x10E6 time one byte into EEPROM. > > Has anybody an idea? Any help greatly appreciated! > > > Best regards > > Peter -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist