I was working on project where i have to run my tasks based on priority value. higher the priority of tasks that task should execute first and followed by next higher task, this should continue to the last task which has lowest priority.
example of code is:
printf(“task1 is created\n”);
printf(“task2 is created\n”);
printf(“task3 is created\n”);
printf(“task4 is created\n”);
xTaskCreate(myTask1, ( signed char * ) "TX1",configMINIMAL_STACK_SIZE,NULL,9,&myTaskHandle1); xTaskCreate(myTask2, ( signed char * ) "TX2",configMINIMAL_STACK_SIZE,NULL,4,&myTaskHandle2); xTaskCreate(myTask3, ( signed char * ) "TX3",configMINIMAL_STACK_SIZE,NULL,10,&myTaskHandle3); xTaskCreate(myTask4, ( signed char * ) "TX4",configMINIMAL_STACK_SIZE,NULL,1,&myTaskHandle4); vTaskStartScheduler();
As shown in the above code if we assume the priorities of taks which creating first is 9 and next is 4 ,10,1 respectively.
i want 3rd Task should execute first and then 1st, 2nd and 4th at last.
but we are not getting the output as expected.
i have defined a macro #define configMAX_PRIORITIES ( 10 )
please let me know if any changes required.