Quote Originally Posted by Acetronics View Post
Hi, Peu

NO, you did not understand ...

1) You enable BODEN, nothing else required ...

2) AT program start, you first read the BOR bit

3) If BOR Bit = 0 THEN (and only IF ) you increase the EEPROM content : That means power is back, and did not reach ZERO !!! ( no Pb to write , then ...)

4) If BOR Bit = 1 power has gone to ZERO ( and BOR bit has been reset ) ... just read the EEPROM content .

5) you SET BOR bit

6) you run your "lighting" program ...

Think simple !!!

Alain
I still have a doubt: when does the BOD bit goes from the initialization value ZERO (table 9-6) to ONE (No Brown-out Detect occurred) in a cold start scenario?

At cold start the circuit should read the stored eeprom value not write a new one