retentive memory

Another way to look at it is to have a Power Fail flag in EEPROM. Each time the program starts the flag is set to true. Only a graceful shutdown (by means of a button, etc.) will set the flag to false. We use this technique in our Point of Sale application. It still requires a button or the like as halley suggested.