HD404654 Series
84
Comparator
The block diagram of the comparator is shown in figure 71. The comparator compares input voltage with
the reference voltage.
Setting 1 to bit 3 (CER3) of the compare enable register (CER: $018) executes a voltage comparison. If an
input voltage at COMP
0
or COMP
1
is higher than the reference voltage, the TM or TMD command sets the
status flag (ST) high for the corresponding bits of the compare data register (CDR: $017) to COMP
0
or
COMP
1
. On the other hand, if an input voltage at COMP
0
or COMP
1
is lower than the reference voltage,
the TM or TMD command clears the ST to 0.
S
+
–
Com-
parator
Comparator data
register (CDR)
Comparator enable
register (CER)
I
0
COMP
VC
2
ref
COMP
1
Figure 71 Block Diagram of Comparator
Compare Enable Register (CER: $018):
Three-bit write-only register which enables comparator
operation, and selects the reference voltage and the analog input pin.
Compare Data Register (CDR: $017):
Two-bit read-only register which latches the result of the
comparison between the analog input pins and the reference voltage. Bits 0 and 1 reflect the results of
comparison with COMP
0
and COMP
1
, respectively. This register can be read only by the TM or TMD
command. Only bit CER3 corresponds to the analog input pin, which is selected by bits CER0 and CER1.
After a compare operation, the data in this register is not retained.
Note on Use:
During compare operation, pins RD
0
/COMP
0
and RD
1
/COMP
1
operate as analog inputs and
cannot operate as R ports.
The comparator can operate in active mode but is disabled in other modes.
RE
0
/VC
ref
cannot operate as an R port when the external input voltage is selected as the reference.