I've got a problem now that I don't quite understand.
The way I decided to go is to use a Goldcap to keep the AVR powered for 1-2 secs while detecting the power down using an
interrupt (INT0). Standard configuration Vcc -> x -> diode -> Goldcap -> AVR. INT0 is connected to point "x".
It does work, but there's a problem: If power fails and comes back on after a short time (up to about 30 sec) the AVR seems to seize up, it only outputs garbage on the display and stops working. Only after a longer power failure it comes back on properly.
I reckon it's got something to do with the power stored in the Goldcap, if that's at some weird level when power comes back on the AVR doesn't reset properly.
As I understand the datasheet if you connect Pin 9 RESET of the ATmega32 to Vcc it is forced to do a reset at power up. Maybe the voltage doesn't drop far enough for that to work properly?
Here's the schematic (drawn in my own version of DaveCAD

):
http://dplinks.ath.cx/pics/elektro/AL12_SchaltplanV1.pdfAnd another question regarding the actual code.
When INT0 is triggered the AVR jumps to the appropriate ISR where it writes data into the eeprom. Then the return command is issued.
As I expect that nothing else happens now after power is going down what would be the best command to issue after the data is written to eeprom? Do I just let it return to the main prog? Do I stop the AVR? What do you guys think?
I hope I could make myself clear

Cheers, David