0
0
Embedded Cprogramming~10 mins

Idle mode behavior 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 enter idle mode using the correct instruction.

Embedded C
void enter_idle_mode() {
    __[1]();
}
Drag options to blanks, or click blank then click option'
AWFI
BNOP
CWFE
DSVC
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOP does not enter idle mode; it just does nothing for one cycle.
Using SVC triggers a supervisor call, not idle mode.
WFE waits for an event, which is different from waiting for an interrupt.
2fill in blank
medium

Complete the code to enable the idle mode by setting the correct bit in the power control register.

Embedded C
POWER_CTRL_REG |= (1 << [1]);
Drag options to blanks, or click blank then click option'
A3
B0
C2
D1
Attempts:
3 left
💡 Hint
Common Mistakes
Setting bit 0 might enable a different power mode.
Bits 2 and 3 are usually for other power states.
3fill in blank
hard

Fix the error in the code that attempts to enter idle mode but uses the wrong instruction.

Embedded C
void idle_mode() {
    __[1]();
}
Drag options to blanks, or click blank then click option'
AWFI
BWFE
CNOP
DSVC
Attempts:
3 left
💡 Hint
Common Mistakes
Using NOP does not enter idle mode.
Using WFE waits for an event, not an interrupt.
SVC triggers a supervisor call.
4fill in blank
hard

Fill both blanks to create a dictionary that maps power modes to their bit positions.

Embedded C
const int power_modes_bits[] = { [1], [2] };
Drag options to blanks, or click blank then click option'
A0
B1
C2
D3
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing bit positions for different power modes.
5fill in blank
hard

Fill all three blanks to complete the function that sets the processor to idle mode and enables the correct power control bit.

Embedded C
void set_idle_mode() {
    POWER_CTRL_REG |= (1 << [1]);
    __[2]();
    while (!(STATUS_REG & (1 << [3]))) {
        ;
    }
}
Drag options to blanks, or click blank then click option'
A1
BWFI
C0
DWFE
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong bits for enabling or checking status.
Using WFE instead of WFI.