Hi everyone, I hope someone will help me with my problem. I’m using RTOS window port to simulate. I don’t know why my lower priority task is stopped when the higher priority task is delayed. Here is my code
This is code for task 1(priority = 1)
void vTaskFunction(void *pvParameter) {
char *pcTaskName;
pcTaskName = (char*)pvParameter;
for (;;) {
printf("%s count = %d \n", pcTaskName,count++);
}
}
this is code for task 2(priority = 2):
void vEventFunction(void *pvParameter) {
char *pcTaskName;
pcTaskName = (char*)pvParameter;
for (;;) {
printf("%s \n", pcTaskName);
vTaskDelay(10 / portTICK_PERIOD_MS);
}
}
This is what I have in main:
static const char * pcTextForTask1 = " Task 1 is running ";
static const char * pcTextForTask2 = " Task 2 is running ";
xTaskCreate(vTaskFunction, " Task 1", 1000,
(void *)pcTextForTask1, 1, NULL);
xTaskCreate(vEventFunction, " Task 2", 1000,
(void *)pcTextForTask2, 2, NULL);
vTaskStartScheduler();
This is my output:
When task2 is delayed, task1 should run through, but it doesn’t, it loop about 40 times and stop. Please help me