R01UH0823EJ0100 Rev.1.00
Page 1649 of 1823
Jul 31, 2019
RX23W Group
47. Comparator B (CMPBa)
47.3.2
Comparator Bn Output Function (n = 2, 3)
The comparison result from comparator B can be output to external pins. The CPB1OCR.CPBnOP and
CPB1OCR.CPBnOE bits can be used to set the output polarity (non-inverted output or inverted output) and output
enabled or disabled. For the register settings and corresponding comparator output, refer to
Comparator B1 Output Control Register (CPB1OCR)
.
To output the comparator B comparison result to the CMPOB2 or CMPOB3 output pin, use the following procedure to
make port settings. Note that the ports are set to input after a reset.
(1) Set the mode and input for comparator B (steps 1 to 10 listed in
and steps 1 to 6 listed in
).
(2) Select the polarity of the CMPOB2 or CMPOB3 output and enable the output (set the CPB1OCR.CPBnOP and
CPB1OCR.CPBnOE bits).
(3) Set the port mode register and pin function control register corresponding to the CMPOB2 or CMPOB3 output pin
(start outputting from the pin).
47.3.3
Example of Using Comparator B to Exit Software Standby Mode
The following shows an example of using comparator B2 output to exit software standby mode.
In this example, it is assumed that the reference input voltage (CVREFB2) > analog input voltage (CMPB2).
Set the following steps (1) to (3) before entering software standby mode.
(1) Set the registers associated with comparator B2 according to
.
However, set the CPB1F.CPB2FEN bit to ‘filter is disabled’, the CPB1OCR.CPB2OE bit to ‘output enabled’, and
the CPB1OCR.CPB2OP bit to ‘comparator B2 output is output to CMPOB2’.
(2) Make the IRQ7 interrupt settings according to
section 15.4.8, External Pin Interrupts
However, set the IRQFLTE0.FLTEN7 bit to 0 (digital filter disabled) and set the IRQCR7.IRQMD[1:0] bits to the
same polarity as that of comparator B2 output.
In this example, a rising edge is selected.
(3) Set the multi-function pin controller to select the CMPOB2 function and enable IRQ7.
When exiting software standby mode, input a voltage from the comparator B2 analog pin (CMPB2) so that the reference
input voltage (CVREFB2) is less than the analog input voltage (CMPB2). This allows the IRQ7 interrupt to be generated
through the comparator B2 output pin (CMPOB2) and the MCU exits software standby mode.