
S1C8F360 TECHNICAL MANUAL
EPSON
125
5 PERIPHERAL CIRCUITS AND THEIR OPERATION (Analog Comparator)
5.14.2 Mask option
The input terminals of the analog comparator are
shared with the I/O port terminals P14–P17.
Therefore, the terminal specification of the analog
comparator is decided by setting the I/O port mask
option.
In the S1C8F360, the P14–P17 port specification is
fixed at "without pull-up resistor".
5.14.3 Analog comparator operation
By writing "1" to the analog comparator control
register CMPxON, the analog comparator goes ON,
and the analog comparator starts comparing the
external voltages that have been input to the two
differential input terminals CMPPx and CMPMx.
The result can be read from the comparator com-
parison result detection bit CMPxDT through the
latch and when CMPPx (+) > CMPMx (-), it is "1"
and when CMPPx (+) < CMPMx (-), it is "0". 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.
When the analog comparator is turned OFF, the
comparison result at that point will be latched and
the concerned data can be read thereafter, until the
analog comparator is turned ON.
You should turn the analog comparator OFF, when
it is not necessary, so as to reduce current consump-
tion.
See Chapter 10, "ELECTRICAL CHARACTERISTICS"
for the input voltage range.
Note: Since the input terminals of the analog
comparator are shared with 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.
5.14 Analog Comparator
5.14.1 Configuration of analog comparator
The S1C8F360 has an MOS input analog compara-
tor built into two channels. The respective analog
comparators have two differential input terminals
(inverted input terminal CMPMx and non-inverted
input terminal CMPPx) that are available for
general purpose use.
Figure 5.14.1.1 shows the configuration of the
analog comparator.
Fig. 5.14.1.1 Configuration of analog comparator
Since the input terminals of the analog comparator
CMPP0, CMPM0, CMPP1 and CMPM1 are com-
mon to I/O ports P14–P17, when using as the input
terminal for the analog comparator, "0" (input
mode) must be written to I/O control registers
IOC14–IOC17.
Table 5.14.1.1 Input terminal configuration
Terminal
P14
P15
P16
P17
When analog comparator is used
CMPP0
CMPM0
CMPP1
CMPM1
Data
bus
CMP0DT
VDD
VSS
CMPP0 (P14)
CMPM0 (P15)
+
–
CMP0ON
CMP1DT
VDD
VSS
CMPP1 (P16)
CMPM1 (P17)
+
–
CMP1ON
Latch
<Channel 0>
<Channel 1>
Note: The P14–P17 terminals are shared with the
A/D converter input ports. Therefore, do not
run the A/D converter when the analog
comparator is used.