Application Examples
The following application example is written with both methods of
power-fail detection in mind.
The flowchart indicates that two
different paths may be taken depending on whether the cause is an
external battery failure or an AC power failure.
If an external battery failure is being detected, it is assumed that the
non-maskable interrupt remains until the battery is replaced, so the
code goes into an idle loop awaiting battery change. System restart
occurs with a new power-up.
If an AC power failure is being detected, a non-maskable interrupt
may occur, followed by the AC power being restored to a good level
without DC power going below 4.75 V. Therefore, the system may
not be reset every time. To monitor when the non-maskable interrupt
goes away in this situation, you may wire-wrap the power-fail NMI
request at W1 to one of the unused printer port signals (SLCT, BUSY,
PE) on pins 20, 16, and 18 of connector J6. If the input is a logical 1,
the NMI request remains active.
The following example also illustrates the use of one of the 8254
counter/timers as a watchdog timer. A watchdog timer is used to
indicate that the system’s software has gotten lost and the system
should be restarted. Under normal operation, the timer is programmed
(by the system software) to periodically trigger the watchdog circuit
to prevent an "alarm" interrupt from being generated.
4-30