
M0A21/M0A23 Series
May 06, 2022
Page
690
of 746
Rev 1.02
M0
A21
/M
0
A
2
3
SE
RIES
TEC
H
NICAL
RE
FEREN
C
E
M
ANUAL
specified channels. Software can select which channel to be monitored by setting CMPCH
(ADC_ADCMPRx[7:3]). CMPCOND (ADC_ADCMPRx[2]) bit is used to determine the compare
condition. If CMPCOND bit is cleared to 0, the internal match counter will increase one when the
conversion result is less than the value specified in CMPD (ADC_ADCMPRx[27:16]); if CMPCOND bit
is set to 1, the internal match counter will increase one when the conversion result is greater than or
equal to the value specified in CMPD (ADC_ADCMPRx[27:16]). When the conversion of the channel
specified by CMPCH(ADC_ADCMPRx[7:3]) is completed, the comparing action will be triggered one
time automatically. When the compare result meets the setting, compare match counter will increase 1,
otherwise, the compare match counter will be cleared to 0. When the match counter reaches the setting
of (CM1) then CMPF0/1 (ADC_ADSR0[1]/[2]) bit will be set to 1, if CMPIE
(ADC_ADCMPRx[1]) bit is set then an ADC interrupt request is generated. Software can use it to monitor
the external analog input pin voltage transition in scan mode without imposing a load on software. The
detailed logic diagram is shown below.
12-bit
Comparator
RSLT >=CMPD
RSLT < CMPD
CMPCOND(ADCMPRx[2])
1
0
CMPFx
(ADSR0[2:1])
A/D
analog
macro
Channel
Addr.
2
3
t
o
1
A
n
a
lo
g
M
U
X
Match
Counter
CMPMATCNT
(ADCMPRx[11:8])
AIN0
AIN16
…
…
CHANNEL(ADSR0[31:27])
CMPCH(ADCMPRx[7:3])
ADDRx[11:0]
CMPD(ADCMPRx[27:16])
Note:
CMPD=ADCMPRx[27:16]
RSLT=ADDRx[11:0]
V
BG
V
TEMP
DAC0_OUT
INT_VREF
Figure 6.19-7 A/D Conversion Result Monitor Logic Diagram
Compare Window Mode
The ADC controller supports a compare window mode. User can set CMPWEN (ADC_ADCMPR0[15])
to enable this function. If user enables this function, CMPF0 (ADC_ADSR0[1]) will be set only when
compared conditions of two conversion result monitor logic are matched and CMPF1 (ADC_ADSR0[2])
will always be zero. The range of compare window is between CMPD (ADC_ADCMPR0[27:16]) and
CMPD (ADC_ADCMPR1[27:16]).
PDMA Transfer Mode
When A/D conversion is finished, the conversion result will be loaded into ADC_ADDRx(x=0~16,
26,27,29,30) register and VALID(ADC_ADDRx[17]) bit will be set to 1. If the PTEN(ADC_ADCR[9]) bit
is set, ADC controller will generate a request to PDMA. User can use PDMA to transfer the conversion
results to a user-specified memory space without CPU's intervention. The source address of PDMA
operation is fixed at ADC_ADPDMA, no matter what channels was selected. When PDMA is transferring
the conversion result, ADC will continue converting the next selected channel if the operation mode of
ADC is burst mode, single scan mode or continuous scan mode. User can monitor current PDMA
transfer data through reading ADC_ADPDMA register. If ADC completes the conversion of a selected
channel and the last conversion result of the same channel has not been transferred by PDMA,
OVERRUN(ADC_ADSR2[31:0]) bit of the corresponding channel will be set and the last ADC
conversion result will be overwritten by the new ADC conversion result. PDMA will transfer the latest
data of selected channels to the user-specified destination address.
Interrupt Sources
There are three interrupt sources of ADC interrupt. When an ADC operation mode finishes its
conversion, the A/D conversion end flag, ADF(ADC_ADSR0[0]), will be set to 1. The