Just use a simple voltage drop detector. I use a 4.5v detect on the supply of my odometers and I've tested the crap out of this application and NEVER fails to write the value to EEPROM once power is disrupted. The volt detector is nothing more than a "switch" to ground thus when it's supply which shares the supply of the pic, goes to 4.5 volts or lower, it will switch any input selected on the pic to low to activate your "save data" routine. Use a capacitor of 220uf to slowly drain the power while giving time to do the action. Once your action is complete, use a resistor or load to complete the cap drain...
Bookmarks