Power Brown Outs
John Payson email (remove spam text)
> Here's a brain buster.
> We have a stand alone CO gas monitor (safety equipment) that uses a
> If the power supply is momentarily shorted (milliseconds), the PIC does
> not recover, but locks up in random modes.
> We have the Watchdog timer ON and CLRWDT is only given one time in the
> main program loop.
> Any ideas? I was massacred today in an engineering meeting as this
> instrument was on the verge of its first major shipment.
I think the biggest issue to watch for is the possibility that a power
glitch might have 'bizarre' effects on the PIC's registers without trashing
it totally. For example, if you set the TRIS registers on startup and never
again, they may get glitched without the program knowing it. If an input
becomes an output, the program could become "blind" to the true state of that
input; if an output becomes an input the program would, without knowing it,
become ineffectual at writing that pin.
This problem can be mitigated for some registers (like TRISA, TRISB, etc.)
by simply reloading the registers periodically. For other registers, things
may be a little harder. Your best bet is probably to have the program--just
after the CLRWDT--check the state of the system to ensure that it makes
sense. If you have some bytes to spare, it may be helpful to have a "second
order" software watchdog. If the software is supposed to do certain things in
response to certain events, you could create software counters/timers to
monitor such things. For example, if the system contains a modem which can
only answer the phone when not conducting a measurement (measurements should
normally take 5-15 seconds), a simple software watchdog could periodically
check the state of the phone ring signal. If the phone has rung five times
within a 45-second period, odds are really good that SOMETHING is going wrong
in the measurement routine.
Note that even with well-programmed software watchdogs, and a hardware watch-
dog to check for extreme conditions, power glitches can still cause system
problems. If your software can't deal acceptable with registers that get
garbled, you could consider a brownout-reset circuit. This will be much more
reliable than a watchdog at detecting errors resulting from glitches. It
won't, however, detect faults due to code glitches so a watchdog is still a
In reply to: <m0u4g1Q-000BEhC@mailbox.mcs.com> from "James Musselman" at Apr 3, 96 11:02:27 am
See also: www.piclist.com/techref/power.htm?key=power
You must be a member of the
piclist mailing list
(not only a www.piclist.com member) to post to the