OK, that gives you plenty to work with. You should be able to adapt the schematic in the thread I linked you to.
What we are basically doing is monitoring the 12 volt in this case. An ADC could be used but you will have to keep checking it in your code. If you use the interrupt on change then it all happens for you...
Either way, the trick is having large enough caps to run the PIC long enough to write the data to eeprom. When the voltage coming to the PIC or the power supply drops beyond a certain point your software will jump to a SAVE/SHUT DOWN routine.
The problem I see happening with you setup is the voltage drops enough to go to the SAVE routine then comes back up before the PIC actually stops from lack of voltage.





Bookmarks