GD32W51x User Manual
361
In the regular group, a sequence of up to 9 conversions can be organized in a specific
sequence. The ADC_RSQ0~ADC_RSQ2 registers specify the selected channels of the
regular group. The RL[3:0] bits in the ADC_RSQ0 register specify the total conversion
sequence length.
In the inserted group, a sequence of up to 4 conversions can be organiz ed in a specific
sequence. The ADC_ISQ register specifies the selected channels of the inserted group. The
IL[1:0] bits in the ADC_ISQ register specify thetotal conversion sequence length.
14.4.4.
Conversion modes
Single conversion mode
This mode can be used in both regular and inserted channel groups. In the single conversion
mode, the ADC performs conversion on the channel specified in the RSQ0[4:0] bits in
ADC_RSQ2 or the channel specified in the ISQ3[4:0] bits in ADC_ISQ. When the ADCON is
1, the ADC samples and converts a single channel, once the corresponding software trigger
or external trigger is active.
Figure 14-2. Single conversion mode
CH2
CH2
CH2
CH2
CH2
EOC
Regular
trigger
Sample
Convert
After conversion of a single regular channel, the conversion data will be stored in the
ADC_RDATA register, the EOC will be set. An interrupt will be generated if the EOCIE bit is
set.
After conversion of a single injected channel, the conversion data will be stored in the
ADC_IDATA0 register, the EOC and EOIC will be set. An interrupt will be generated if the
EOCIE or EOICIE bit is set.
Software procedure for a single conversion of a regular channel:
1. Make sure the DISRC, SM in the ADC_CTL0 register and CTN bit in the ADC_CTL1
register are reset;
2. Configure the RSQ0 with the analog channel number;
3. Configure the ADC_SAMPTx register;
4. Configure the ETMRC and ETSRC bits in the ADC_CTL1 register if it is needed;
5. Set the SWRCST bit, or generate an external trigger for the regular group;
6. Wait for the EOC flag to be set;
7. Read the converted result from the ADC_RDATA register;
8. Clear the EOC flag by writing 0.
Software procedure for a single conversion of an inserted channel:
1. Make sure the DISIC, SM in the ADC_CTL0 register are reset;