R01UH0823EJ0100 Rev.1.00
Page 1644 of 1823
Jul 31, 2019
RX23W Group
47. Comparator B (CMPBa)
47.3
Operation
Comparator B2 and comparator B3 operate independently, and their operations are the same. Operation is not guaranteed
when the values of registers are changed during comparator operation.
shows the procedure of setting
comparator B associated registers when the window function is disabled.
shows the procedure of setting
comparator B associated registers when the window function is enabled.
Note 1. This setting is necessary when changing the reference input voltage from the CVREFBn input to the internal reference voltage
or from the internal reference voltage to the CVREFBn input. When selecting the CVREFBn input after the reset is released,
steps 4, 5, 7, and 8 are not necessary because the initial value of the CPB1REF.CPBnVRF bit is 0.
Table 47.3
Procedure for Setting Registers Associated with Comparator B When Window Function is
Disabled (n = 2, 3)
Step
No.
Register
Bit
Setting
1
PijPFS of the port to which
the CMPBn pin is assigned
ASEL
1
2
CPB1MD
CPBSPDMD
Select the comparator response speed
(0: High-speed mode/1: Low-speed mode)
3
CPB1CNT1
CPBnINI
Powered on: 1
4
CPB1CNT2
CPBnWCP
1*
5
CPB1REF
CPBnVRF
0: Reference input voltage =
CVREFBn input*
1: Reference input voltage =
Internal reference voltage
6
PijPFS of the port to which
the CVREFBn pin is
assigned
ASEL
1
0
7
Waiting for the comparator stabilization time (min. 100 μs)*
8
CPB1CNT2
CPBnWCP
0*
9
CPB1F
Select whether to enable or disable the filter and select the sampling clock.
10
Waiting for the comparator stabilization time (min. 100 μs)
11
CPB1OCR
CPBnOP, CPBnOE
Set the CMPOBn output (select the polarity and set output enabled or
disabled).
12
CPB1INT
CPBnINTEN
When using an interrupt: 1 (interrupt enabled)
CPBnINTEG
When using an interrupt or the ELC: Select the input edge (1 = both
edges or 0 = single edge).
CPBnINTPL
When using an interrupt or the ELC: For CPBnINTEG = 0 (single edge
selected), select the input polarity (1 = rising edge or 0 = falling edge).
13
IPR104 (comparator B2),
IPR105 (comparator B3)
IPR[3:0]
When using an interrupt: Select the interrupt priority level.
IR104 (comparator B2),
IR105 (comparator B3)
IR
When using an interrupt: 0 (no interrupt requested: initialization)
IER07
IEN0 (comparator B2),
IEN1 (comparator B3)
When using an interrupt: 1 (interrupt is enabled on the interrupt
controller (ICU) side)