0
0
Embedded Cprogramming~10 mins

Why timers are 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 timer.

Embedded C
TIMER_START([1]);
Drag options to blanks, or click blank then click option'
Adelay
Btimer1
Cstart
Dcount
Attempts:
3 left
💡 Hint
Common Mistakes
Using action words like 'start' instead of the timer name.
Passing delay or count instead of the timer identifier.
2fill in blank
medium

Complete the code to check if the timer has expired.

Embedded C
if ([1]_expired()) {
    // Timer expired actions
}
Drag options to blanks, or click blank then click option'
Atimer2
Btimer_expired
Ctimer1
Dexpired
Attempts:
3 left
💡 Hint
Common Mistakes
Using generic words like 'expired' without the timer name.
Using incorrect timer names like 'timer2' if not defined.
3fill in blank
hard

Fix the error in the timer initialization code.

Embedded C
void init_timer() {
    [1] = 0;
    TIMER_CONFIGURE(timer1, 1000);
}
Drag options to blanks, or click blank then click option'
Atimer
Btimer1
Ccount
Dtimer1_count
Attempts:
3 left
💡 Hint
Common Mistakes
Resetting the timer variable instead of the count variable.
Using generic names like 'count' without context.
4fill in blank
hard

Fill both blanks to create a delay using the timer.

Embedded C
while (![1]_expired()) {
    [2]();
}
Drag options to blanks, or click blank then click option'
Atimer3
Bdo_nothing
Ctimer1
Dwait
Attempts:
3 left
💡 Hint
Common Mistakes
Using wrong timer names in the expiration check.
Leaving the loop body empty causing high CPU usage.
5fill in blank
hard

Fill all three blanks to set up and start a timer with a callback.

Embedded C
void setup() {
    [1] = 500;
    TIMER_CONFIGURE(timer2, [2]);
    TIMER_START([3]);
}
Drag options to blanks, or click blank then click option'
Adelay_ms
Ctimer2
Dtimer1
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names for delay in the first two blanks.
Starting the wrong timer.