User manual

AN020201-0904 Discussion
2
Application Note
Battery-Level Detection in Z8 GP MCU Peripherals
Two independent comparators with programmable interrupt polarity
Figure 2 shows a block diagram of the ZGP323 and ZGR323 devices.
Discussion
In remote control applications, and in other applications in which noise is present,
V
CC
can bounce for a few hundred mV. Typically, a microcontrollers Low Voltage
Detection (LVD) function cannot determine whether a battery voltage reading is
truly detecting a low battery, or if the reading is actually a reflection of noise in the
circuit. To address this issue, ZiLOG’s Z8 GP microcontrollers offer a High Voltage
Detection (HVD) function to ensure that true low battery voltage can be detected
in a noisy environment.
If both HVD and LVD are set within the monitoring period, the battery can be con-
sidered to be viable, with plenty of life remaining. LVD can be triggered by noise
only. However, if only LVD is set but HVD is clear for a period, the user is alerted
by the low battery voltage detection function. After low voltage has been detected
and the battery has been replaced with a fresh battery, HVD is triggered.
The code sample that follows details how to enable and detect high and low volt-
age.
Figure 2. ZGP323 and ZGR323 Block Diagram
P00
Port 0
I/O Nibble
Programmable
I/O Nibble
Programmable
I/O Bit
Programmable
Port 3
Machine
Timing &
Instruction
Control
Power
Register File
256 x 8-Bit
EPROM
4K, 8K,
16K, 32K
Expanded
Register
File
Counter/Timer 8
8-Bit
Counter/Timer 16
16-Bit
Z8 MCU
Core
Port 1
Port 2
P01
P02
P03
P04
P05
P06
P07
P10
P11
P12
P13
P14
P15
P16
P17
P20
P21
P22
P23
P24
P25
P26
P27
Pref1/P30
P31
P32
P33
P34
P35
P36
P37
XTAL
V
V
RESET
DD
SS