Z8 Microcontrollers
ZiLOG I/O Ports
UM001601-0803 5-27
5.8.3 COMPARATOR OPERATION
After enabling the Analog Comparator mode, P33 becomes a
common reference input for both comparators. The P33 (Ref) is
hard wired to the reference inputs to both comparators and can
-
not be separated. P31 and P32 are always connected to the posi-
tive inputs to the comparators. P31 is the positive input to com-
parator AN1 while P32 is the positive input to comparator AN2.
The outputs to comparators AN1 and AN2 are AN1-out and
AN2-out, respectively.
The comparator output reflects the relationship between the pos-
itive input to the reference input.
Example: If the voltage on AN1 is higher than the voltage on Ref
then AN1-out will be at a high state. If voltage on AN2 is lower
than the voltage on Ref then AN2-out will be at a Low state. In
this example, when the Port 3 register is read, Bits D1 = 1 and
D2 = 0. If the comparator outputs are enabled to come out on P34
and P37, then P34 = 1 and P37 = 0. Please note that the previous
data stored in P34 and P37 is not disturbed. Once the comparator
outputs are de-selected the stored values in the P34 and P37 reg
-
ister bits will be reflected on these pins again.
5.8.4 Interrupts
In the example from Section 5.8.3, P32 (AN2) will generate an
interrupt based on the result of the comparison being low and the
Interrupt Request Register (IRQ FAH) having bits D7=0 and
D6=0. If IRQ D7=1 and D6=0 then both P31 and P32 would
generate interrupts.
5.8.5 Comparator Definitions
5.8.5.1 V
ICR
The usable voltage range for both positive inputs and the refer-
ence input is called the common mode voltage range (V
ICR
). The
comparator is not guaranteed to work if the inputs are outside of
the V
ICR
range.
5.8.5.2 V
OFFSET
The absolute value of the voltage between the positive input and
the reference input required to make the comparator output volt
-
age switch is the input offset voltage (V
OFFSET
). If AN1 is 3.000V
and Ref is 3.001V when the comparator output switches states
then the Voffset = 1mV.
5.8.5.3 I
IO
For CMOS voltage comparator inputs, the input offset current
(I
IO
) is the leakage current of the CMOS input gate.
5.8.6 RUN Mode
P33 is not available as an interrupt input during Analog Mode.
P31 and P32 are valid interrupt inputs in conjunction with P33
(Ref) when in the Analog Mode.
P31 can still be used as T
IN
when the analog mode is selected. If
comparator outputs are desired to be outputted on the Port 3 out
-
puts, please refer to specific products specification for priority of
mixing when other special features are sharing those same Port
3 pins.
5.8.7 HALT Mode
The analog comparators are functional during HALT Mode if
the Analog Mode has been enabled. P31 and P32, in conjunction
with P33 (Ref) will be able to generate interrupts. Only P33 can
-
not generate an interrupt since the P33 input goes directly to the
Ref input of the comparators and is disconnected from the inter
-
rupt sensing circuits.
5.8.8 STOP Mode
The analog comparators are disabled during STOP Mode so it
does not use any current at that time. If P31, P32, or P33 are used
as a source for Stop-Mode Recovery, the Port 3 Digital Mode
must be selected by setting bit D1=0 in the Port 3 Mode Register.
Otherwise in STOP Mode, the P31, P32, and P33 cannot be
sensed. If the Analog Mode was selected when entering STOP
Mode, it will still be enabled after a valid SMR triggered reset.