0
0
Embedded Cprogramming~10 mins

Why watchdog timer is needed 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 start the watchdog timer.

Embedded C
WDTCTL = [1];
Drag options to blanks, or click blank then click option'
AWDTPW | WDTTMSEL
BWDTPW | WDTHOLD
CWDTPW | WDTSSEL
DWDTPW | WDTCNTCL
Attempts:
3 left
💡 Hint
Common Mistakes
Using WDTHOLD stops the watchdog timer instead of starting it.
2fill in blank
medium

Complete the code to reset the watchdog timer inside the main loop.

Embedded C
while(1) {
    [1];
    // main program tasks
}
Drag options to blanks, or click blank then click option'
AWDTCTL = WDTPW | WDTSSEL
BWDTCTL = WDTPW | WDTHOLD
CWDTCTL = WDTPW | WDTCNTCL
DWDTCTL = WDTPW | WDTTMSEL
Attempts:
3 left
💡 Hint
Common Mistakes
Using WDTHOLD inside the loop stops the watchdog timer, defeating its purpose.
3fill in blank
hard

Fix the error in the watchdog timer initialization code.

Embedded C
WDTCTL = [1]; // Start watchdog timer
Drag options to blanks, or click blank then click option'
AWDTPW | WDTHOLD
BWDTPW | WDTCNTCL
CWDTPW | WDTHOLD | WDTCNTCL
DWDTPW
Attempts:
3 left
💡 Hint
Common Mistakes
Including WDTHOLD stops the watchdog timer immediately.
4fill in blank
hard

Fill both blanks to create a dictionary of task names and their watchdog reset status.

Embedded C
const char* tasks[] = {"Sensor", "Motor", "Display"};
int resetStatus[] = {1, 0, 1};
for(int i = 0; i < 3; i++) {
    printf("Task: %s, Reset: %d\n", [1], [2]);
}
Drag options to blanks, or click blank then click option'
Atasks[i]
BresetStatus[i]
Ctasks
DresetStatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using the array name without index prints the pointer address.
5fill in blank
hard

Fill all three blanks to implement a watchdog timer reset check with condition.

Embedded C
if([1] [2] 1000) {
    [3] = 0; // Reset watchdog timer counter
}
Drag options to blanks, or click blank then click option'
AwatchdogCounter
B>
D<
Attempts:
3 left
💡 Hint
Common Mistakes
Using less than operator reverses the logic.