Bird
0
0

This FreeRTOS code snippet has an error:

medium📝 Debug Q6 of 15
FreeRTOS - RTOS Fundamentals
This FreeRTOS code snippet has an error:
void Task(void *pvParameters) {
  while(1) {
    vTaskDelay(100);
    printf("Running");
  }
}
What is the error?
AvTaskDelay argument should be in ticks, not milliseconds
Bprintf cannot be used inside tasks
Cwhile(1) should be for(;;)
DTask function must return an int
Step-by-Step Solution
Solution:
  1. Step 1: Check vTaskDelay parameter

    vTaskDelay expects delay in ticks, not raw milliseconds.
  2. Step 2: Correct usage

    Use vTaskDelay(100 / portTICK_PERIOD_MS) to convert milliseconds to ticks.
  3. Final Answer:

    vTaskDelay argument should be in ticks, not milliseconds -> Option A
  4. Quick Check:

    vTaskDelay needs ticks, not ms [OK]
Quick Trick: Convert ms to ticks using portTICK_PERIOD_MS [OK]
Common Mistakes:
  • Passing milliseconds directly to vTaskDelay
  • Thinking printf is disallowed
  • Confusing loop syntax

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes