Hi Emavil,
You could monitor the PICs voltage supply for a loss and as soon as the PIC sees the voltage dropping write the variables to the EEPROM built-in to the PIC. As soon as the power up occurs you read back the vairables as part of your INIT routine.
As for monitoring the power, I would put a 100uF capacitor on the PICs Vdd to ground and monitor the power coming into the power supply using something like an opto-isolator that will signal the loos of power coming in.
HTH,
BobK
Bookmarks