S1C88348/317/316/308 TECHNICAL HARDWARE
EPSON
I-137
5 PERIPHERAL CIRCUITS AND THEIR OPERATION (Analog Comparator)
5.14.4 Control of analog comparator
Table 5.14.4.1 shows the analog comparator control bits.
Table 5.14.4.1 Analog comparator control bits
CMP0ON, CMP1ON: 00FF13HD2, D3
Controls the analog comparator ON/OFF.
When "1" is written: ON
When "0" is written: OFF
Reading:
Valid
The analog comparator 0 goes ON by writing "1" to
CMP0ON and goes OFF, when "0" is written. The
analog comparator 1 can be controlled with
CMP1ON in the same way.
At initial reset, this register is set "0" (OFF).
CMP0DT, CMP1DT: 00FF13HD0, D1
The comparison result of the analog comparator
can be read out.
When "1" is read:
CMPPx (+) > CMPMx (-)
When "0" is read:
CMPPx (+) < CMPMx (-)
Writing:
Invalid
The result of analog comparator 0 can be read from
CMP0DT. When the status of external voltage input
to differential input terminals CMPP0 and CMPM0
is CMPP0 (+) > CMPM0 (-), CMP0DT becomes "1"
and when it is CMPP0 (+) < CMPM0 (-), CMP0DT
becomes "0".
As the same way, the comparison result between
CMPP1 and CMPM1 can be read from CMP1DT.
When the analog comparator is turned OFF, the
latched result immediately prior to going OFF is
read out.
At initial reset, this bit is set to "1".
5.14.5 Programming notes
(1) To reduce current consumption, turn the analog
comparator OFF (CMP0ON = CMP1ON = "0")
when it is not necessary.
(2) After the analog comparator has been turned
ON, a maximum time of 3 msec is necessary
until output stabilizes. Consequently, you
should allow an adequate waiting time after
turning the analog comparator ON, before
reading the comparison result.
(3) Since the input terminals of the analog compa-
rator are common to the I/O ports, the I/O
control registers (IOC14–IOC17) corresponding
to the channel to be used must be set to the
input mode.
Address Bit
Name
SR R/W
Function
Comment
10
00FF13 D7
D6
D5
D4
D3
D2
D1
D0
–
CMP1ON
CMP0ON
CMP1DT
CMP0DT
–
Comparator 1 On/Off control
Comparator 0 On/Off control
Comparator 1 data
Comparator 0 data
Constantly "0" when
being read
–
0
R/W
R
–
On
+ > -
–
Off
+ < -