One thing to remember. The diode D1 is isolating the PIC supply from the LED. So the PIC should be able to stay in a brown out mode for a small amount of time. But your test circuit may have a problem if the indicator LED is directly connected to a PIC I/O pin. The LED may then drain the PIC power too fast and the PIC will go into POR quicker. The AMC7135 parts in the original design isolate the PIC pin enough so that it can still run off the cap charge. You need a higher impedance connection, on your test board, to the PIC to keep this from happening. Maybe you can put a buffer (like a HC04) between the indicator LED and the PIC pin and power the buffer straight off the supply.
Also in your code, when you check the BOD, you also need to check the POR. This is because you will have one of two situations:
BOD cleared but POR still set - Switch click
BOD cleared and POR cleared - powered down
Your code also needs to set both bits after they are checked, otherwise they will never be '1'. The hardware only clears the bits when a situation happens. It is the program's responsibility to set these bits.




Bookmarks