GD32VF103 User Manual
160
Figure 11-6. Discontinuous conversion mode
CH2
CH1
CH5
CH7
CH11
CH16
CH2
CH1
· · ·
Inserted
trigger
EOC
One circle of regular group, RL=7, DISNUM=2
CH9
CH10
CH8
CH9
CH10
· · ·
EOIC
One circle of inserted group, IL=2
Regular
trigger
Sample
Convert
CH12
CH17
CH5
Software procedure for discontinuous conversion on a regular channel group:
1.
Set the DISRC bit in the ADC_CTL0 register and the DMA bit in the ADC_CTL1 register
2.
Configure DISNUM[2:0] bits in the ADC_CTL0 register
3.
Configure ADC_RSQx and ADC_SAMPTx registers
4.
Configure ETERC and ETSRC bits in the ADC_CTL1 register if in need
5.
Prepare the DMA module to transfer data from the ADC_RDATA (refer to the spec of the
DMA
module).
6.
Set the SWRCST bit, or generate an external trigger for the regular group
7.
Repeat step6 if in need.
8.
Wait the EOC flag to be set
9.
Clear the EOC flag by writing 0 to it
Software procedure for discontinuous conversion on an inserted channel group:
1.
Set the DISIC 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.
Repeat step4 if in need
6.
Wait the EOC/EOIC flags to be set
7.
Read the converted in the ADC_IDATAx register
8.
Clear the EOC/EOIC flag by writing 0 to them
11.4.6.
Inserted channel management
Auto-insertion
The inserted group channels are automatically converted after the regular group channels
when the ICA bit in ADC_CTL0 register is set. In this mode, external trigger on inserted
channels cannot be enabled. A sequence of up to 20 conversions programmed in the
ADC_RSQ0~ADC_RSQ2 and ADC_ISQ registers can be used to convert in this mode. In
addition to the ICA bit, if the CTN bit is also set, regular channels followed by inserted
channels are continuously converted.