0
0
Embedded Cprogramming~10 mins

Multi-channel ADC scanning in Embedded C - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to start ADC conversion.

Embedded C
ADC_Start([1]);
Drag options to blanks, or click blank then click option'
AADC_CHANNEL_2
BADC_CHANNEL_1
CADC_CHANNEL_0
DADC_CHANNEL_3
Attempts:
3 left
💡 Hint
Common Mistakes
Using a channel number that is not defined or out of range.
2fill in blank
medium

Complete the code to read the ADC value from the specified channel.

Embedded C
uint16_t value = ADC_Read([1]);
Drag options to blanks, or click blank then click option'
AADC_CHANNEL_1
BADC_CHANNEL_2
CADC_CHANNEL_3
DADC_CHANNEL_0
Attempts:
3 left
💡 Hint
Common Mistakes
Reading from a channel that was not started or configured.
3fill in blank
hard

Fix the error in the code to correctly configure ADC for multi-channel scanning.

Embedded C
ADC_ConfigTypeDef adcConfig;
adcConfig.scanConvMode = [1];
adcConfig.continuousConvMode = ENABLE;
Drag options to blanks, or click blank then click option'
ADISABLE
BENABLE
CSTART
DSTOP
Attempts:
3 left
💡 Hint
Common Mistakes
Setting scan mode to DISABLE disables multi-channel scanning.
4fill in blank
hard

Fill both blanks to set the number of channels and the first channel in the ADC sequence.

Embedded C
adcConfig.NbrOfConversion = [1];
adcConfig.Channel = [2];
Drag options to blanks, or click blank then click option'
A3
BADC_CHANNEL_0
CADC_CHANNEL_1
D5
Attempts:
3 left
💡 Hint
Common Mistakes
Setting the wrong number of conversions or wrong starting channel.
5fill in blank
hard

Fill all three blanks to complete the loop that reads ADC values from multiple channels.

Embedded C
for (int i = 0; i < [1]; i++) {
    adcValues[i] = ADC_Read([2] + i);
}
ProcessValues(adcValues, [3]);
Drag options to blanks, or click blank then click option'
A4
BADC_CHANNEL_0
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong loop count or wrong channel start index.