RL78/F13, F14 CHAPTER 14 COMPARATOR (RL78/F14 Only)
R01UH0368EJ0210 Rev.2.10 789
Dec 10, 2015
14.3.2 Comparator Interrupts
The comparator generates an interrupt request. The comparator interrupt functions provide priority specification flag,
interrupt mask flag, interrupt request flag, and interrupt vector.
When using the comparator interrupt, set at least one of bits CEGP and CEGN in the CMPCTL register to 1 (to a value
other than 00B (no edge selection)).
For details on the register setting related to comparator interrupt request, refer to 14.2.2 Comparator Control Register
(CMPCTL).
To use the comparator interrupt in STOP mode, set the CSTEN bit in CMPCTL register to 1 (releasing STOP mode by
comparator interrupt enabled) and set the CDFS1 and CDFS0 bits to 00 (digital noise filter not used).
14.3.3 Comparator ELC Event Output
An ELT event is generated in accord to settings of the comparator output inversion control (CINV bit) and noise filter
output (CDFS1 and CDFS0 bits) in the CMPCTL register. Use the ELSELR19 register of the ELC for selection of event
output destination and disabling the event link operation.
14.3.4 Comparator Pin Output
The comparison result from the comparator can be output to external pins. Bits CINV and CPOE in the CMPSEL
register can be used to set the output polarity (output is inverted or not) and to enable or disable the output. For the
correspondence between the register setting and the comparator pin output, refer to 14.2.2 Comparator Control
Register (CMPCTL).
14.3.5 Stopping or Supplying Comparator Clock
To stop the comparator by setting peripheral enable register 1 (PER1), use the following procedure:
<1> Set the HCMPON bit in the CMPCTL register to 0 (stop the comparator input).
<2> Set the CMPEN bit in the PER1 register to 0.
<3> Set the interrupt flag (CMPIF0 bit in the IF0L register) to 0 (clear any unnecessary interrupt before stopping the
comparator).
When the clock is stopped by setting PER1, all the internal registers in the comparator are initialized. To use the
comparator again, follow the procedure in table 14-13 to set the registers.