Bird
0
0

Which of the following is the correct FreeRTOS API call for a producer task to send data to a queue?

easy📝 Syntax Q12 of 15
FreeRTOS - Design Patterns for RTOS

Which of the following is the correct FreeRTOS API call for a producer task to send data to a queue?

void producerTask(void *params) {
    int data = 10;
    // Send data to queue here
}
AxQueueSend(queueHandle, &data, portMAX_DELAY);
BxQueueReceive(queueHandle, &data, portMAX_DELAY);
CxTaskCreate(queueHandle, &data, portMAX_DELAY);
DvTaskDelay(queueHandle);
Step-by-Step Solution
Solution:
  1. Step 1: Identify the correct API for sending data to a queue

    FreeRTOS uses xQueueSend() to send data from a producer to a queue.
  2. Step 2: Check other options for correctness

    xQueueReceive() is for receiving data, xTaskCreate() creates tasks, and vTaskDelay() delays tasks, so they are incorrect here.
  3. Final Answer:

    xQueueSend(queueHandle, &data, portMAX_DELAY); -> Option A
  4. Quick Check:

    Send data = xQueueSend [OK]
Quick Trick: Use xQueueSend to put data into the queue [OK]
Common Mistakes:
  • Using xQueueReceive to send data
  • Confusing task creation with queue operations
  • Using delay functions instead of queue functions

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More FreeRTOS Quizzes