>> How I can detect a power loss?
Lot of ways to do this ... without a schematic or more detail it is hard to say what is best. For moderately low power projects, I place a fast diode between the power supply and VDD. I also place a cap between VDD and GND. I then monitor the voltage from the anode of the diode (also connected to the PIC through a diode) and sense when it goes low (with ADC or Comparators). When it goes low, I shut off everything and write to EEPROM. I size the cap to give me enough time to do this.
Others might do this differently (like using BOD).
Paul Borgmeier
Salt Lake City, UT
USA
__________________
Bookmarks