Interrupt on power loss? (newbie question)

Can someone tell me, is there a way to get the arduino to generate an interrupt on power loss?

I guess (please correct) that there's a little delay or latency between loss of power and the processor ceasing to function. All I need to do is store away a long value into EEPROM before power down so that I can restore that value on the next power up.

Currently I write the value to EEPROM every time it changes but it struck me that I don't need to do that, I only need to write before power down.

Can anyone help? Can this be done?

Cheers.

Little battery backup and relay to call interrupt?

This was asked a few weeks ago. I seem to recall the solution was to use a capacitor to provide enough power to perform the shutdown procedure.

the solution was to use a capacitor to provide enough power to perform the shutdown procedure.

Like this

http://ruggedcircuits.com/html/circuit__13.html

Although they have a clever way to do it without using an interrupt. The basic circuit is good though.


Rob