On 10/10/2011 9:26 AM, IB Peter Feucht wrote: > But when a BOR occured during operation, the software will never reach th= e > end of the software, thus the variable stays set and on next start the > software sees a set variable and based on this I can decide to disable > starting the software again. Just blink some leds and go to sleep again. > > Anyone did this before? Hopefully I have some time tonight to write the > software. > > Best regards > > Peter > > The way I handle this is to monitor the status of the reset and if it=20 ever indicates that the fault was due to a power failure then the software sets a bit in the eeprom and powers=20 off. On power up the code checks this bit, if it is set then the device=20 will beep 3 times to give the user the chance to press a keypad button=20 telling the device the battery is changed, if pressed the bit is reset=20 and the device functions like normal. If no key press then the device=20 powers off. This also has the advantage of alerting the user to the reason why the=20 device turned off last time when things like good batteries but corroded=20 terminals, loose fitting batteries were the problem. Mark --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .