0
0
Embedded Cprogramming~10 mins

Enabling and disabling interrupts 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 enable global interrupts.

Embedded C
sei(); // Call the function to [1] interrupts
Drag options to blanks, or click blank then click option'
Adisable
Benable
Ccheck
Dclear
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing enable with disable
Using functions that clear flags instead
2fill in blank
medium

Complete 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'
Acheck
Benable
Cset
Ddisable
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing disable with enable
Using functions that set flags instead
3fill in blank
hard

Fix the error in the code to enable interrupts.

Embedded C
void enable_interrupts() {
    [1]();
}
Drag options to blanks, or click blank then click option'
Asei
Bcli
Cint_enable
Dinterrupt_on
Attempts:
3 left
💡 Hint
Common Mistakes
Using cli() instead of sei()
Using non-standard function names
4fill in blank
hard

Fill 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'
Acli
Bsei
Cenable
Ddisable
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing the order of enable and disable
Using incorrect function names
5fill in blank
hard

Fill 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'
ASREG
BI
Ccli
Dsei
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong register or bit names
Confusing enable and disable functions