User`s manual
BL1600122 s Memory, I/O Map, and Interrupt Vectors
Nonmaskable Interrupts
Power Failure Interrupts
The following sequence of events takes place when power fails.
1. The power-failure nonmaskable interrupt (NMI) is triggered when the
unregulated DC input voltage falls below approximately 7.9 V.
2. The system reset is triggered when the regulated +5 V supply falls
below 4.65 V. The reset remains enabled as the voltage falls further.
At this point, the chip select for the SRAM is forced high (standby
mode).
3. The time/date clock and SRAM are switched to the lithium backup
battery as the regulated voltage falls below the battery voltage of
approximately 3 V.
The following function shows how to handle a power-failure interrupt.
#JUMP_VEC NMI
_
VEC myint
interrupt retn myint(){
body of interrupt routine
while(!IBIT(WDO,0)){}
// input voltage is still below the threshold
// that triggered the NMI
return; // if just a power glitch, return
}
Normally, a power-failure interrupt routine will not return, but will execute
the shutdown code and then enter a loop until the +5 V voltage falls low
enough to trigger a reset. However, the voltage might fall low enough in a
brownout situation to trigger a power failure interrupt, but not low
enough to reset, resulting in an endless hangup. Bit 0 of WDO is 0 when
the voltage level is below the NMI threshold, and 1 otherwise. If this bit
indicates that the low-voltage condition has reversed itself, then the power-
fail routine can restart execution. If a lowbut not fatally lowvoltage
persists, then you will have to decide what action to take, if any.
A situation similar to a brownout will occur if the power supply is over-
loaded. For example, when an LED is turned on, the voltage supplied to
the Z180 may dip below 7.9 V. The interrupt routine does a shutdown.
This turns the LED off, clearing the problem. However, the cause of the
overload may persist, and the system will oscillate, alternately experienc-
ing an overload and then resetting. To correct this situation, you need to
get a larger power supply.