Difference between revisions of "1. Creating and using a task"
m |
m |
||
(5 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
#In main function we will create 3 tasks viz., MyTask1, MyTask2 and MyTask3 with priorities 1,2 and 3 respectively. | #In main function we will create 3 tasks viz., MyTask1, MyTask2 and MyTask3 with priorities 1,2 and 3 respectively. | ||
#An idle task is also created, which will be run when there are no tasks in RUN state. | #An idle task is also created, which will be run when there are no tasks in RUN state. | ||
− | #Only creating task is not sufficient. Tasks will be executed | + | #Only creating task is not sufficient. Tasks will be executed only when the scheduler is started. |
− | So call vTaskStartScheduler() to start the scheduler. | + | ::So call vTaskStartScheduler() to start the scheduler. |
==Code== | ==Code== | ||
Line 17: | Line 17: | ||
For making it easier to understand what is happening, we are displaying some data on UART. | For making it easier to understand what is happening, we are displaying some data on UART. | ||
− | You can find the function prototypes | + | You can find the function prototypes and details [[RTOS Basics : TASK|here]]. |
− | < | + | <html><script src="https://gist.github.com/Amritach/840e2f9c6b570bfe5b8a.js"></script></html> |
− | + | ||
− | / | + | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | </ | + | |
{{DISQUS}} | {{DISQUS}} |
Latest revision as of 15:16, 24 April 2015
Amruta (talk) 13:44, 8 April 2015 (IST)
Intro
This is our first tutorial with FreeRTOS so start with a simple example of how to create and use a task.
Before going to this tutorial its recommended to first go through the FreeRTOS basics tutorial.
- In main function we will create 3 tasks viz., MyTask1, MyTask2 and MyTask3 with priorities 1,2 and 3 respectively.
- An idle task is also created, which will be run when there are no tasks in RUN state.
- Only creating task is not sufficient. Tasks will be executed only when the scheduler is started.
- So call vTaskStartScheduler() to start the scheduler.
Code
For making it easier to understand what is happening, we are displaying some data on UART.
You can find the function prototypes and details here.