R01UH0823EJ0100 Rev.1.00
Page 1602 of 1823
Jul 31, 2019
RX23W Group
44. 12-Bit A/D Converter (S12ADE)
44.3.5
Compare Function (Window A, Window B)
44.3.5.1
Compare Function Window A/B
The compare function compares the reference value set in the register with the A/D conversion result. The reference
value can be set for window A and window B independently. When the compare function is in use, the self-diagnosis
function and double trigger mode cannot be used. Big differences between window A and window B are different
interrupt output signals and that window B can select only one channel.
The following describes operations in combination of continuous scan mode and the compare function.
(1) When the ADCSR.ADST bit is set to 1 (A/D conversion start) by software, synchronous trigger, or asynchronous
trigger input A/D conversion starts in the order of the selected channel.
(2) Upon completion of A/D conversion, the result is stored in the corresponding A/D data register (ADDRy,
ADTSDR, or ADOCDR). When ADCMPCR.CMPAE is 1, if the ADCMPANSRy register or the ADCMPANSER
register is set for window A, the results of A/D conversion are to be compared with the values set in the
ADCMPDR0 and ADCMPDR1 registers. When ADCMPCR.CMPBE is 1, if the ADCMPBNSR register is set for
window B, the results of A/D conversion are to be compared with the values set in the ADWINULB and
ADWINLLB registers.
(3) As a result of the comparison, when window A meets the condition set in ADCMPDR0, ADCMPDR1 or
ADCMPLER, the compare window A flag (ADCMPSR0.CMPSTCHA0n, ADCMPSR1.CMPSTCHA1n,
ADCMPSER.CMPSTTSA, or ADCMPSER.CMPSTOCA) is set to 1. In the same way, when window B meets the
condition set in ADCMPBNSR.CMPLB, the compare window B flag (ADCMPBSR.CMPSTB) is set to 1.
(4) Upon completion of all selected A/D conversions and comparisons, scan restarts.
(5) Set the ADCSR.ADST bit to 0 (A/D conversion stop), and execute processing for the channel with the compare flag
set to 1.
(6) Clear all compare flags after processing is competed. To perform comparison again, restart A/D conversion.