Bird
0
0

You want a FreeRTOS task to block until it receives multiple notifications and then process the total count. Which ulTaskNotifyTake() call correctly supports this behavior?

hard📝 Application Q8 of 15
FreeRTOS - Task Notifications
You want a FreeRTOS task to block until it receives multiple notifications and then process the total count. Which ulTaskNotifyTake() call correctly supports this behavior?
A<code>uint32_t count = ulTaskNotifyTake(pdTRUE, portMAX_DELAY);</code>
B<code>uint32_t count = ulTaskNotifyTake(pdFALSE, portMAX_DELAY);</code>
C<code>uint32_t count = ulTaskNotifyTake(pdTRUE, 0);</code>
D<code>uint32_t count = ulTaskNotifyTake(pdFALSE, 0);</code>
Step-by-Step Solution
Solution:
  1. Step 1: Understand counting notifications

    To accumulate multiple notifications, the count should NOT be cleared on exit, so xClearCountOnExit must be pdFALSE.
  2. Step 2: Wait indefinitely

    Using portMAX_DELAY ensures the task blocks until at least one notification arrives.
  3. Step 3: Analyze options

    uint32_t count = ulTaskNotifyTake(pdFALSE, portMAX_DELAY); uses pdFALSE and infinite wait, allowing counting multiple notifications before returning.
  4. Step 4: Why others are incorrect

    Options with pdTRUE clear the count on exit, losing accumulated notifications. Zero wait time means no blocking.
  5. Final Answer:

    uint32_t count = ulTaskNotifyTake(pdFALSE, portMAX_DELAY); correctly supports counting multiple notifications before proceeding.
  6. Quick Check:

    Use pdFALSE and portMAX_DELAY to count notifications [OK]
Quick Trick: Set xClearCountOnExit to pdFALSE for counting [OK]
Common Mistakes:
  • Using pdTRUE clears count prematurely
  • Setting zero wait time causes immediate return
  • Confusing clearing behavior with wait time

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes