Application Examples
EXAMPLE 2: POWER-FAIL/WATCHDOG TIMER
Objectives
•
Write routines for system initialization and system restart after
power-fail.
•
Write a routine that handles the non-maskable interrupt that may
be caused by power-fail.
•
Write a routine that handles the maskable interrupt from the
watchdog timer timeout.
•
Determine in the main program whether system restart or system
initialization is in process. Call the appropriate routine and
execute it.
System Level Issues
As discussed in Chapter 3, "Theory of Operation," AC power-fail
protection makes use of the non-maskable interrupt to indicate that
AC power is failing and DC power will soon follow. As shown in the
following example, the AC power detection inputs to the board may
also be used to detect DC power failure, as is the case with a system
powered solely by a large battery.
Adjusting the DC input voltage level is accomplished on the
ZT 8809A by changing the resistor divider network R1 and R2 so that
the input voltage to the power monitor chip, the DS 1231-35, is above
2.5 V when power is good. An equation for adjusting these values is
given on page 4-29. Refer to the discussion in Chapter 3 for further
detail.
4-28