
R8C/3GM Group
29. Comparator A
R01UH0284EJ0100 Rev.1.00
Aug 09, 2011
29.4
Functional Description
Comparator A1 and comparator A2 operate independently.
The comparison result of the reference input voltage and analog input voltage can be read by software. The result
can also be output from the LVCOUTi (i = 1 or 2) pin. An input voltage to the LVREF pin can be used as the
reference input voltage. The comparator A1 interrupt or the comparator A2 interrupt can be used by selecting non-
maskable or maskable for each interrupt type.
29.4.1
Comparator A1
Notes:
1. When the VW1C0 bit is set to 0, steps 6 and 7 can be executed at the same time (with one instruction).
2. When the comparator A1 is enabled while the comparator A1 is disabled, low voltage is detected
and the VW1C2 bit becomes 1.
Table 29.3
Procedure for Setting Bits Associated with Comparator A1 Interrupt
Step
When Using Digital Filter
When Using No Digital Filter
1
Set the COMPSEL bit in the CMPA register to 1 (bits IRQ1SEL and IRQ2SEL enabled).
2
Set the VCA21 bit in the VCA2 register to 1 (LVREF pin input voltage) and
the VCA22 bit to 1 (LVCMP1 pin input voltage).
3
Set the VCA26 bit in the VCA2 register to 1 (comparator A1 circuit enabled).
4
Wait for td(E-A).
5
Select the interrupt type by the IRQ1SEL bit in the CMPA register.
6
Select the sampling clock of the digital filter by
bits VW1F0 and VW1F1 in the VW1C
register.
Set the VW1C1 bit in the VW1C register to 1
(digital filter disabled).
Set the VW1C1 bit in the VW1C register to 0
(digital filter enabled).
8
Select the interrupt request timing by the VCAC1 bit in the VCAC register and
the VW1C7 bit in the VW1C register.
9
Set the VW1C2 bit in the VW1C register to 0.
10
Set the CM14 bit in the CM1 register to 0
(low-speed on-chip oscillator on).
11
Wait for 2 cycles of the sampling clock of
the digital filter.
(No wait time required)
Set the VW1C0 bit in the VW1C register to 1 (comparator A1 interrupt enabled).