Comparator operation, Interrupts, Comparator definitions – Zilog Z86193 User Manual

Page 79

Advertising
background image

Z8

®

CPU

User Manual

UM001604-0108

Input/Output Ports

72

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 cannot be separated. P31 and P32 are always connected to the positive inputs to the
comparators. P31 is the positive input to comparator 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 positive input and the refer-
ence input.

Example
If the voltage on AN1 is higher than the voltage on Ref then AN1-out is at a high state. If
voltage on AN2 is lower than the voltage on Ref then AN2-out is at a Low state. In this
example, when the Port 3 register is read, Bits D1 = 1 and D2 = 0. If the comparator out-
puts are enabled to come out on P34 and P37, then P34 = 1 and P37 = 0.

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 register bits are reflected on these pins
again.

Interrupts

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.

Comparator Definitions

V

ICR

The usable voltage range for both positive inputs and the reference input is called the com-
mon mode voltage range (V

ICR

). The comparator is not guaranteed to work if the inputs

are outside of the V

ICR

range.

V

OFFSET

The absolute value of the voltage between the positive input and the reference input
required to make the comparator output voltage switch is the input offset voltage (V

OFF

-

SET

). If AN1 is 3.000 V and Ref is 3.001 V when the comparator output switches states

then the V

offset

= 1 mV.

LD R0, #XXXX XXX1b

;Enables comparator

;outputs using PCON

;Register programming

Note:

Advertising