0
0
Embedded Cprogramming~10 mins

Single channel ADC reading 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 the ADC conversion.

Embedded C
ADC_Start([1]);
Drag options to blanks, or click blank then click option'
AADC1
BADC2
CADC3
DADC4
Attempts:
3 left
💡 Hint
Common Mistakes
Using an uninitialized ADC channel.
Passing an incorrect channel name.
2fill in blank
medium

Complete the code to check if the ADC conversion is complete.

Embedded C
if (ADC_GetFlagStatus([1]) == SET) { /* conversion done */ }
Drag options to blanks, or click blank then click option'
AADC_FLAG_AWD
BADC_FLAG_OVR
CADC_FLAG_STRT
DADC_FLAG_EOC
Attempts:
3 left
💡 Hint
Common Mistakes
Checking the wrong flag like overrun or start flags.
Confusing flag names.
3fill in blank
hard

Fix the error in reading the ADC value.

Embedded C
uint16_t adcValue = [1]();
Drag options to blanks, or click blank then click option'
AADC_ReadValue
BADC_GetValue
CADC_GetConversionValue
DADC_Read
Attempts:
3 left
💡 Hint
Common Mistakes
Using a non-existent or incorrect function name.
Confusing reading and starting functions.
4fill in blank
hard

Fill both blanks to create a dictionary comprehension that maps channel numbers to their ADC values if the value is above 1000.

Embedded C
adc_results = { [1]: [2] for [1] in channels if [2] > 1000 }
Drag options to blanks, or click blank then click option'
Ach
Badc_value
Cvalue
Dchannel
Attempts:
3 left
💡 Hint
Common Mistakes
Using the same variable name for both blanks.
Using undefined variable names.
5fill in blank
hard

Fill all three blanks to create a dictionary comprehension that maps channel names in uppercase to their ADC values if the value is greater than 2000.

Embedded C
adc_data = { [1].[2](): [3] for [1] in channels if [3] > 2000 }
Drag options to blanks, or click blank then click option'
Ach
Bupper
Cadc_val
Dvalue
Attempts:
3 left
💡 Hint
Common Mistakes
Using incorrect method names.
Mixing variable names.