![GigaDevice Semiconductor GD32E23 Series Скачать руководство пользователя страница 165](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794165.webp)
GD32E23x User Manual
165
the ADC_CTL0 register. When the corresponding software trigger or external trigger is active,
the
ADC
samples
and
converts
the
next
n
channels
configured
in
the
ADC_RSQ0~ADC_RSQ2 registers until all the channels of routine sequence are done. The
EOC will be set after every circle of the routine sequence. An interrupt will be generated if the
EOCIE bit is set.
Figure 10-6. Discontinuous operation mode
CH2
CH1
CH5
CH7
CH11
CH16
CH2
CH1
·
· ·
EOC
One circle of routine sequence, RL=7, DISNUM=2
Sample
Convert
CH12
CH17
CH5
Routine
trigger
Software procedure for discontinuous operation mode on a routine sequence:
1.
Set the DISRC bit in the ADC_CTL0 register and the DMA bit in the ADC_CTL1 register.
2.
Configure the DISNUM [2:0] bits in the ADC_CTL0 register.
3.
Configure the ADC_RSQx and ADC_SAMPTx registers.
4.
Configure the ETERC and ETSRC bits in the ADC_CTL1 register if it is needed.
5.
Prepare the DMA module to transfer data from the ADC_RDATA (refer to the spec of
module).
6.
Set the SWRCST bit, or generate an external trigger for the routine sequence.
7.
Repeat step6 if in need.
8.
Wait the EOC flag to be set.
9.
Clear the EOC flag by writing 0 to it.
10.4.6.
Conversion result threshold monitor function
The analog watchdog is enabled when the RWDEN bit in the ADC_CTL0 register is set for
routine sequence. This function is used to monitor whether the conversion result exceeds the
set thresholds, and the WDE bit in ADC_STAT register will be set. An interrupt will be
generated if the WDEIE bit is set. The ADC_WDHT and ADC_WDLT registers are used to
specify the high and low threshold. The comparison is done before the alignment, so the
threshold values are independent of the alignment, which is specified by the DAL bit in the
ADC_CTL1 register. One or more channels, which are selected by the RWDEN, WDSC and
WDCHSEL [4:0] bits in ADC_CTL0 register, can be monitored by the analog watchdog.
10.4.7.
Data storage mode
The alignment of data stored after conversion can be specified by DAL bit in the ADC_CTL1
register.
When in the most significant bit alignment, the 12/10/8-bit data are aligned on a half-word,
while the 6-bit data are aligned on a byte basis as shown blew