I have a PIC programmed to count the pulses coming from a reed-contact of a water-meter, pulses are relatively slow, 1 pulse / 1 liter. I make the PIC to sleep most of the time only wakeing up at rising edges on the input (of course using a debouncing algorythm), so it can run on a small lithium cell for several years counting the water flow in a register. I have to make the value of the counter to be non-volatile so it will not reset when the battery gets changed, I think of writing the value to the internal EEPROM each time it changes, but I have concerns whether it will overstress the EEPROM write cycle expectancy. Updating the EEPROM is a rather power hungry operation also.
What strategy (or addtional hardware) would you suggest to conserve the counter value during power outages?
Thanks, Laszlo