![](http://datasheet.mmic.net.cn/280000/HD4046612_datasheet_16064609/HD4046612_99.png)
HD404669 Series
99
Registers Used by Comparator
Compare enable register (CER: $018)
Compare data register (CDR: $017)
Compare enable register (CER: $018):
The compare enable register (CER) is a 3-bit write-only register
that selects comparator operation and the analog input pin (figure 77).
CER is reset by an MCU reset or in stop mode.
Analog input pin selection
COMP
0
COMP
1
Not Used
Compare enable register (CER: $018)
Bit
Initial value
Read/Write
Bit name
CER0
0
1
×
CER1
0
1
×
: Don't care
CER3
0
Comparator operation selection
Comparator operation not selected: Digital input mode RD
0
/COMP
0
and RD
1
/COMP
1
pins
function as R port pins
Comparator operation selected: Analog input mode RD
0
/COMP
0
and RD
1
/COMP
1
pins
function as comparator pins
1
3
0
W
CER3
2
—
—
Not Used
0
0
W
CER0
1
0
W
CER1
Figure 77 Compare Enable Register (CER)
Compare data register (CDR: $017):
The compare data register (CDR) is a 2-bit read-only register that
holds the result of the comparison between the analog input pin and the reference voltage (figure 78).
When comparator operation is started (CER3 is set to 1), the result of the comparison between the analog
input pin selected by the compare enable register (CER) and the reference voltage is read into the
corresponding bit of the compare data register (CDR). The value of the other bits in CDR is undetermined.
The CDR value is not retained after the comparator operation (when CER3 = 0), and is undetermined
except during comparator operation.