GD32VF103 User Manual
159
2.
Configure ADC_RSQx and ADC_SAMPTx registers
3.
Configure ETERC and ETSRC bits in the ADC_CTL1 register if in need
4.
Prepare the DMA module to transfer data from the ADC_RDATA.
5.
Set the SWRCST bit, or generate an external trigger for the regular group
6.
Wait the EOC flag to be set
7.
Clear the EOC flag by writing 0 to it
Software procedure for scan conversion on an inserted channel group:
1.
Set the SM bit in the ADC_CTL0 register
2.
Configure ADC_ISQ and ADC_SAMPTx registers
3.
Configure ETEIC and ETSIC bits in the ADC_CTL1 register if in need
4.
Set the SWICST bit, or generate an external trigger for the inserted group
5.
Wait the EOC/EOIC flags to be set
6.
Read the converted in the ADC_IDATAx register
7.
Clear the EOC/EOIC flag by writing 0 to them
Figure 11-5. Scan conversion mode, continuous enable
CH2
CH1
CH5
CH7
CH11
CH2
CH1
· ·
·
EOC
One circle of regular group, RL=4
Regular
trigger
CH5
CH7
CH11
CH2
Discontinuous mode
For regular channel group, the discontinuous conversion mode will be enabled when DISRC
bit in the ADC_CTL0 register is set. In this mode, the ADC performs a short sequence of n
conversions (n<=8) which is a part of the sequence of conversions selected in the
ADC_RSQ0~ADC_RSQ2 registers. The value of n is defined by the DISNUM[2:0] bits in the
ADC_CTL0 register. When the corresponding software trigger or external trigger is active, the
ADC samples and coverts the next n channels selected in the ADC_RSQ0~ADC_RSQ2
registers until all the channels in the regular sequence are done. The EOC will be set after
every circle of the regular channel group. An interrupt will be generated if the EOCIE bit is set.
For inserted channel group, the discontinuous conversion mode will be enabled when DISIC
bit in the ADC_CTL0 register is set. In this mode, the ADC performs one conversion which is
a part of the sequence of conversions selected in the ADC_ISQ register. When the
corresponding software trigger or external trigger is active, the ADC samples and coverts the
next channel selected in the ADC_ISQ register until all the channels in the inserted sequence
are done. The EOIC will be set after every circle of the inserted channel group. An interrupt
will be generated if the EOICIE bit is set.
The regular and inserted groups cannot both work in discontinuous conversion mode. Only
one group conversion can be set in discontinuous conversion mode at a time.