0
0
FreeRTOSprogramming~10 mins

vTaskDelayUntil() for precise timing in FreeRTOS - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to declare the variable that stores the last wake time for precise delay.

FreeRTOS
TickType_t [1] = xTaskGetTickCount();
Drag options to blanks, or click blank then click option'
AxLastWakeTime
BdelayTime
CtickCount
DlastTick
Attempts:
3 left
💡 Hint
Common Mistakes
Using a variable name that does not match the expected naming convention.
Not initializing the variable with the current tick count.
2fill in blank
medium

Complete the code to delay the task precisely for 100 ticks using vTaskDelayUntil.

FreeRTOS
vTaskDelayUntil(&[1], pdMS_TO_TICKS(100));
Drag options to blanks, or click blank then click option'
AdelayTime
BlastTick
CtickCount
DxLastWakeTime
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the wrong variable or a non-pointer argument.
Using vTaskDelay() instead of vTaskDelayUntil().
3fill in blank
hard

Fix the error in the code to correctly use vTaskDelayUntil for a 500 ms delay.

FreeRTOS
TickType_t xLastWakeTime = xTaskGetTickCount();
vTaskDelayUntil([1], pdMS_TO_TICKS(500));
Drag options to blanks, or click blank then click option'
A&xLastWakeTime
BxLastWakeTime
C*xLastWakeTime
DxLastWakeTime&
Attempts:
3 left
💡 Hint
Common Mistakes
Passing the variable without the address operator.
Using incorrect pointer syntax.
4fill in blank
hard

Fill both blanks to create a periodic task that delays precisely for 200 ms.

FreeRTOS
TickType_t [1] = xTaskGetTickCount();
vTaskDelayUntil(&[2], pdMS_TO_TICKS(200));
Drag options to blanks, or click blank then click option'
AxLastWakeTime
BdelayTime
DtickStart
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names for declaration and usage.
Not passing the address of the variable in the function call.
5fill in blank
hard

Fill all three blanks to implement a task that toggles an LED every 250 ms using vTaskDelayUntil.

FreeRTOS
void vTaskToggleLED(void *pvParameters) {
    TickType_t [1] = xTaskGetTickCount();
    for(;;) {
        toggleLED();
        vTaskDelayUntil(&[2], pdMS_TO_TICKS([3]));
    }
}
Drag options to blanks, or click blank then click option'
AxLastWakeTime
C250
D200
Attempts:
3 left
💡 Hint
Common Mistakes
Using different variable names in declaration and function call.
Setting the wrong delay time.
Not passing the address of the variable.