English
Language : 

Z8F1680SH020SG Datasheet, PDF (281/412 Pages) Zilog, Inc. – High-Performance 8-Bit Microcontrollers
Z8 Encore! XP® F1680 Series
Product Specification
256
Chapter 18. Comparator
The Z8 Encore! XP F1680 Series devices feature two same general purpose comparators
that compares two analog input signals. For each comparator, a GPIO (C0INP/C1INP) pin
provides the positive comparator input, the negative input (C0INN/C1INN) can be taken
from either an external GPIO pin or an internal reference. The output of each comparator
is available as an interrupt source or can be routed to an external pin using the GPIO mul-
tiplex. Features for each comparator include:
• Two inputs which are connected using the GPIO multiplex (MUX)
• One input can be connected to a programmable internal reference
• One input can be connected to the on-chip temperature sensor
• Output can trigger timer counting
• Output can be either an interrupt source or an output to an external pin
• Operation in STOP Mode
18.1. Operation
One of the comparator inputs can be connected to an internal reference which is a user-
selectable reference that is user-programmable with 200 mV resolution.
The comparator can be powered down to save supply current or to continue to operate in
STOP Mode. For details, see the Power Control Register 0 section on page 44. In STOP
Mode, the comparator interrupt (if enabled) automatically initiates a Stop Mode Recovery
and generates an interrupt request. In the Reset Status Register (see page 40), the stop bit is
set to 1. Also, the Comparator request bit in the Interrupt Request 1 Register (see page 74)
is set. Following completion of the Stop Mode Recovery, and if interrupts are enabled, the
CPU responds to the interrupt request by fetching the comparator interrupt vector.
Caution: Because of the propagation delay of the comparator, spurious interrupts can result after
enabling the comparator. Zilog recommends not enabling the comparator without first
disabling interrupts, then waiting for the comparator output to settle.
The following code example shows how to safely enable the comparator:
di
ldx CMP0,r0
nop
PS025015-1212
PRELIMINARY
Comparator