![GigaDevice Semiconductor GD32E23 Series Скачать руководство пользователя страница 163](http://html.mh-extra.com/html/gigadevice-semiconductor/gd32e23-series/gd32e23-series_user-manual_2225794163.webp)
GD32E23x User Manual
163
Software procedure for single operation mode of a routine channel:
1.
Make sure the DISRC, SM bits in the ADC_CTL0 register and CTN bit in the ADC_CTL1
register are reset;
2.
Configure RSQ0 with the analog channel number.
3.
Configure the ADC_SAMPTx register.
4.
Configure the ETERC and ETSRC bits in the ADC_CTL1 register if in need.
5.
Set the SWRCST bit, or generate an external trigger for the routine sequence.
6.
Wait for the EOC flag to be set.
7.
Read the converted data result from the ADC_RDATA register.
8.
Clear the EOC flag by writing 0.
Continuous operation mode
The continuous operation mode will be enabled when the CTN bit in the ADC_CTL1 register
is set. In this mode, the ADC performs conversion on the channel specified in the RSQ0[4:0].
When the ADCON has been set high, the ADC samples and converts specified channel,
once the corresponding software trigger or external trigger is active. The conversion data will
be stored in the ADC_RDATA register.
Figure 10-3. Continuous operation mode
CH2
CH2
CH2
CH2
CH2
CH2
EOC
Routine
trigger
Sample
Convert
CH2
Software procedure for continuous operation mode on a routine channel:
1.
Set the CTN bit in the ADC_CTL1 register.
2.
Configure the RSQ0 with the analog channel number.
3.
Configure the ADC_SAMPTx register.
4.
Configure the ETERC and ETSRC bits in the ADC_CTL1 register if it is needed.
5.
Set the SWRCST bit, or generate an external trigger for the routine sequence.
6.
Wait the EOC flag to be set.
7.
Read the converted data result in the ADC_RDATA register.
8.
Clear the EOC flag by writing 0 to it.
9.
Repeat steps 6~8 as soon as the conversion is in need.
To get rid of checking, DMA can be used to transfer the converted data:
1.
Set the CTN and DMA bits in the ADC_CTL1 register.
2.
Configure the RSQ0 with the analog channel number.
3.
Configure the ADC_SAMPTx register.
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.
6.
Set the SWRCST bit, or generate an external trigger for the routine sequence.