Queues: How Does the Data get to the Task?

On this link: http://www.freertos.org/a00117.html And on page 170 of there reference manual, shows essentially the same example. What I am trying to understand ishow the data gets into the task that performs xQueueSend? These examples show a task that does not use the vTaskDelayUntil( … ) function. I want to send a string to a UART from various tasks. For the sake of the example, let’s say I am using the example struct “AMessage” Let’s say I have function somewhere in another deterministic task that executes at 1 second intervals. I want to send a UART message from here. In contect of the provided examples, how do I do this? Sorry if it’s a silly question, but I do not see this clearly. Thanks!

Queues: How Does the Data get to the Task?

I don’t fully understand the scenario you are describing. Is this right: You want to send a message to a UART from a task that executes every 1 second? If so, where is a queue being used and what is being sent over the queue? Or is this right: You want to send a string over a queue, but you don’t know how to get a pointer to the string into the function that calls xQueueSend() (as its best to queue a pointer to the string, not the whole string)? In which case it would not seem to be a FreeRTOS question, but a C question (passing data in function parameters, or in file scope variables, etc.) – which is why I don’t think it is this case. You mention the manual – do you mean the reference manual or the book. The book, which discusses queues, is available here: http://www.freertos.org/Documentation/RTOS_book.html

Queues: How Does the Data get to the Task?

A Queue basically provides the service of holding data, and manages task execution holding off tasks until there is room for data (on a send) or data available (on a take). The giving task/ISR needs to gather the information it wants to put in the Queue into a block of memory, call the send function, which when there is room, will copy that data into a corresponding block of memoryy inside the Queue, and when tthe receiving task/ISR does a take, it provides a similar buffer that the queue will copy the data to. The Queue has nothing to do with how the sender filled the block of memory initially, or what the reciever does with its copy after it is given. Because the data gets copies twice (once into the queue, and again out of the queue) it is best if the data is small, and if you want to send bigger blocks (or variable sized blocks) you actually just send a pointer to the data, and manage the data buffer so that the sender doesn’t change that block of memory until after the reciever finishes using it, but instead it uses some other block of memory.

Queues: How Does the Data get to the Task?

I am sorry for the question – it was kinda dumb. Got it all figured out and working. I do have another question about return values and wait times I will ask separately. thank you.