Your “ADDED” schematic shows a 16F84A, which has no analog features – if you are using this PIC, you will need to use an external comparator (or something else) to detect the dropping voltage. On the plus side, the 84A has a 10,000,000 EEPROM Write endurance, which is 10X that of the 16F628. This means you can 10X the numbers Keith has in post 7. Also keep in mind these numbers are theoretical and not guaranteed (but in many cases, way conservative).
If you are using the F628, the only change I have on my schematic is another diode between the anode and the analog pin. This ensures the the analog input voltage is the same as VDD and not higher (which would be out of spec).
The best thing to do would be to skip the power detect and do as Jerson suggested (and not record every second but only when a change was detected). If the estimated number of changes is not too many (see Keith's post 7 for numbers), then you are set. If it is too many, you have another option. You can, in software, set up a “wear leveling” approach (as SKIMASK just noted while I was writing this) and use all locations of the EEPROM. This would give you a theoretical endurance of 127 million writes for the 628 and 630 million for the 84A. Some PICs require refreshing of all the EEPROM after a certain number of writes to any location in EEPROM (e.g., 1 Million writes) – check your datasheet. You can extend this approach by using and external EEPROM and have Trillions+ of writes.
Good Luck
Last edited by paul borgmeier; - 17th March 2007 at 07:26.
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Bookmarks