Hi Peter, This variable that you are talking about - will this be stored in EEPROM/flash or RAM? I think that RAM contents may be destroyed during a brown-out condition. Probably not, but I wouldn't rely on it. It seems to me that others have already mentioned that there are status bits in the PIC which will tell you whether the last reset was a power-on reset or a brown-out condition. Why not simply check for this at every boot and if it was a brown-out reset, then do not operate. Replacing the batteries will cause a power-on reset instead and then you can resume normal operation. Sean On Mon, Oct 10, 2011 at 9:26 AM, IB Peter Feucht wrote= : > Hi, > > thanks anybody for the hints, very helpful! > > 1. I read paragraph 12.3.5. but when 12.3.6. started with power-up stuff = I > stopped read=EDng, power UP was not my problem. I learned: Better read so= me > pages more. > > 2. Some guys were discussing, if BOR is useful for battery detection. Yes= , > you are right, if the circuitry is always operated in "full power mode". = In > this case it will never leave the brown out condition. But in my device t= he > user starts the software by a key press, then it's operating for 15 or 20 > minutes, consuming much power, but after that it goes to sleep mode, > consuming nearly zero amps. During this sleep the batteries may recover a= nd > next time my PIC sees a "full" battery, but during operation the voltage = can > go low again. > That's why I was looking for this distinction. > > What I intend to do: > > I have a variable which is reset by every cold boot (initialized to zero > when PIC starts). > When user presses the key, this variable is set to 1 (I assume that a BOR > will happen) > After normal operation (when no BOR happened) I reset this variable again > and the PIC goes to sleep. > So when it wakes up again, it sees a reset variable. Fine. > 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 > > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > --=20 http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .