0
0
Embedded Cprogramming~10 mins

Why embedded debugging is different in Embedded C - Test Your Understanding

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

Complete the code to initialize the microcontroller's UART for debugging output.

Embedded C
UART_Init([1]);
Drag options to blanks, or click blank then click option'
A9600
B115200
C4800
D19200
Attempts:
3 left
💡 Hint
Common Mistakes
Using a very low baud rate slows down debugging output.
Choosing a non-standard baud rate may cause communication errors.
2fill in blank
medium

Complete the code to turn on an LED connected to pin 13 for debugging purposes.

Embedded C
GPIO_WritePin(13, [1]);
Drag options to blanks, or click blank then click option'
AHIGH
BLOW
CTOGGLE
DINPUT
Attempts:
3 left
💡 Hint
Common Mistakes
Using LOW turns the LED off instead of on.
Using TOGGLE is not a valid argument for this function.
3fill in blank
hard

Fix the error in the interrupt service routine declaration for debugging.

Embedded C
void [1] ISR_Handler(void) { /* handle interrupt */ }
Drag options to blanks, or click blank then click option'
A__interrupt
B__isr
CISR
Dinterrupt
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'interrupt' without underscores may cause syntax errors.
Using 'ISR' or '__isr' may not be recognized by the compiler.
4fill in blank
hard

Fill both blanks to create a dictionary-like structure mapping error codes to messages for debugging.

Embedded C
const char* error_messages[] = { [[1]] = "Overrun", [[2]] = "Timeout" };
Drag options to blanks, or click blank then click option'
A1
B0
C2
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Using indices out of order or invalid indices.
Confusing error codes with message strings.
5fill in blank
hard

Fill all three blanks to implement a simple debug log function that prints a message only if debugging is enabled.

Embedded C
void debug_log(const char* msg) {
    if ([1]) {
        [2](msg);
        [3]();
    }
}
Drag options to blanks, or click blank then click option'
ADEBUG_ENABLED
Bprintf
Cfflush
DDEBUG_MODE
Attempts:
3 left
💡 Hint
Common Mistakes
Using undefined flags like DEBUG_ENABLED instead of DEBUG_MODE.
Forgetting to flush output, causing delayed prints.