Queue-based application [STM32 and FreeRTOS].
![](https://en.depfields.com/wp-content/uploads/2020/06/duck-3217049_640.jpg)
This application combines a task and a queue. This program is not practical, but it is a sample program for learning to understand the concept of queues in an easy-to-understand way.
![](https://en.depfields.com/wp-content/uploads/2020/05/instructor.jpg)
In the initial setting, xQueue = xQueueCreate(16, sizeof (int8_t)) is executed to allocate 16 queues.
![](https://en.depfields.com/wp-content/uploads/2020/05/instructor.jpg)
In the first task, the command ("start@") is entered and 10 queues are passed sequentially when the conditions for establishment are met. The cycle time of the task is set short at 10 ms.
![](https://en.depfields.com/wp-content/uploads/2020/05/instructor.jpg)
The second task displays strings according to the order of the queue. The cycle of the task is set longer at 500 ms for display purposes.
![](https://en.depfields.com/wp-content/uploads/2020/05/instructor.jpg)
The functions of the sample program can be summarized as below.
![](https://en.depfields.com/wp-content/uploads/2020/05/instructor.jpg)
When the program is started, it waits for a command code, so give the code "start@" from the terminal software on the PC. The STM microcontroller then sends 10 parameter IDs to the queue.
![](https://en.depfields.com/wp-content/uploads/2020/05/instructor.jpg)
When IDs are sent to the queue, ID numbers are sequentially displayed according to the queue ID (ID display is sent to the PC side) in a task that executes the display according to the queue order (display in 500 ms cycles).
![](https://en.depfields.com/wp-content/uploads/2020/05/instructor.jpg)
This program itself is not very meaningful from a practical standpoint, but it will help you understand the concept of queues.
![](https://en.depfields.com/wp-content/uploads/2020/06/sirial-usart-nucleo_en.jpg)