In a recent project, the PIC was powered from 12 volts DC via a 5 volt regulator. I had a large capacitor on the o/p of the regulator, then used a voltage divider from the 12 volt supply to a PIC pin such that the voltage was just above the pins ON threshold voltage. When the 12 power dropped, the PIC pin went low, and I saved the various values in eeprom. At 03:40 PM 10/5/2003 -0700, you wrote: >Hi, > >In a project at hand, I would like to save some data into the onboard >EEPROM of a PIC16F870 when the power fails or is turned off. A large >capacitor in the power supply ensures that when the main supply fails, >there are still a few hundred milliseconds before the supply into PIC >touches zero. How can one detect such a power failure and then >immediately launch into the EEPROM write subroutine (while there is >juice in the capacitor)? I don't really want to save the data regularly >after every few seconds (analogous to Autosave in MS Word), but only >when the power goes. > >Thanks, >Mohit. > >-- >http://www.piclist.com hint: The list server can filter out subtopics >(like ads or off topics) for you. See http://www.piclist.com/#topics Larry Bradley Orleans (Ottawa), Ontario, CANADA -- http://www.piclist.com hint: The list server can filter out subtopics (like ads or off topics) for you. See http://www.piclist.com/#topics