OS_Task_Create (priority, TaskName)
Create task. After creation, the task will be added to the list of active tasks.
For mikroC users: All function-tasks should be defined with the #pragma fncall directive, e.g.:
#pragma fncall main MyTask
void MyTask (void)
{
…
Not in interrupt
priority |
Task priority. Allowed values from 0 (highest) to 7 (lowest). |
TaskName |
Name of C-function to be used as task |
bError |
If there is no free descriptor to create task then OS_IsError will return true |
void Task1 (void) { for (;;) OS_Yield(); } void Task2 (void) { for (;;) OS_Yield(); } void main (void) { OS_Init(); OS_Task_Create(1, Task1); // Create task Task1 with priority 1 OS_Task_Create(5, Task2); // Create task Task2 with priority 5 /*...*/ }
OS_CreateTask