Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to enable global interrupts.
Embedded C
sei(); // Call the function to [1] interrupts Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing enable with disable
Using functions that clear flags instead
✗ Incorrect
The sei() function enables global interrupts in embedded C.
2fill in blank
mediumComplete the code to disable global interrupts.
Embedded C
cli(); // Call the function to [1] interrupts Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing disable with enable
Using functions that set flags instead
✗ Incorrect
The cli() function disables global interrupts in embedded C.
3fill in blank
hardFix the error in the code to enable interrupts.
Embedded C
void enable_interrupts() {
[1]();
}
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using
cli() instead of sei()Using non-standard function names
✗ Incorrect
The correct function to enable interrupts is sei(). Using cli() disables them.
4fill in blank
hardFill both blanks to disable interrupts and then enable them again.
Embedded C
void toggle_interrupts() {
[1]();
// some code
[2]();
}
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing the order of enable and disable
Using incorrect function names
✗ Incorrect
First, cli() disables interrupts, then sei() enables them again.
5fill in blank
hardFill all three blanks to check if interrupts are enabled, and disable them if yes.
Embedded C
if ([1] & (1 << [2])) { [3](); }
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong register or bit names
Confusing enable and disable functions
✗ Incorrect
The SREG register holds the interrupt flag I. If set, interrupts are enabled. Then cli() disables them.