0
0
Embedded Cprogramming~10 mins

Feeding (kicking) the watchdog 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 feed the watchdog by writing the correct function call.

Embedded C
void main() {
    // Feed the watchdog
    [1]();
}
Drag options to blanks, or click blank then click option'
Astop_watchdog
Bstart_watchdog
Ckick_watchdog
Dinit_watchdog
Attempts:
3 left
💡 Hint
Common Mistakes
Using start_watchdog() instead of feeding function.
Using stop_watchdog() which disables the watchdog.
Using init_watchdog() which only initializes but does not feed.
2fill in blank
medium

Complete the code to initialize the watchdog with a timeout value of 1000 milliseconds.

Embedded C
void setup() {
    watchdog_init([1]);
}
Drag options to blanks, or click blank then click option'
A1000
B500
C2000
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using 0 disables the watchdog timer.
Using 500 or 2000 sets incorrect timeout values.
3fill in blank
hard

Fix the error in the watchdog feeding code by completing the missing function call.

Embedded C
int main() {
    while(1) {
        // Feed the watchdog
        [1]();
        delay_ms(500);
    }
    return 0;
}
Drag options to blanks, or click blank then click option'
Ainit_watchdog
Bkick_watchdog
Cwatchdog_stop
Dwatchdog_start
Attempts:
3 left
💡 Hint
Common Mistakes
Using watchdog_start() which only starts but does not feed.
Using watchdog_stop() which disables the watchdog.
Using init_watchdog() which initializes but does not feed.
4fill in blank
hard

Fill both blanks to create a dictionary that maps watchdog states to their descriptions.

Embedded C
const char* watchdog_states[] = {"[1]", "[2]"};
Drag options to blanks, or click blank then click option'
AACTIVE
BINACTIVE
CSTARTED
DSTOPPED
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'STARTED' and 'STOPPED' which are less common terms.
Mixing up the order of states.
5fill in blank
hard

Fill all three blanks to complete the watchdog feeding function with proper checks.

Embedded C
void feed_watchdog() {
    if (watchdog_[1]()) {
        [2]_watchdog();
    } else {
        watchdog_[3]();
    }
}
Drag options to blanks, or click blank then click option'
Ais_running
Bkick
Cstart
Dstop
Attempts:
3 left
💡 Hint
Common Mistakes
Using stop instead of start in the else branch.
Using start instead of kick to feed the watchdog.
Checking wrong status function.