Difference between revisions of "1. Creating and using a task"
m |
m |
||
(10 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
[[category: RTOS Tutorials]] | [[category: RTOS Tutorials]] | ||
− | + | [[User:Amruta|Amruta]] ([[User talk:Amruta|talk]]) 13:44, 8 April 2015 (IST) | |
---- | ---- | ||
==Intro== | ==Intro== | ||
This is our first tutorial with FreeRTOS so start with a simple example of how to create and use a task. | 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. | 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. | + | #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 when the scheduler is started. |
− | + | ::So call vTaskStartScheduler() to start the scheduler. | |
− | Only creating task is not sufficient. Tasks will be executed | + | |
− | So call vTaskStartScheduler() to start the scheduler. | + | |
==Code== | ==Code== | ||
Line 19: | 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.