Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

What happen's if priority change

Status
Not open for further replies.

Daljeet12

Member level 4
Member level 4
Joined
Jun 16, 2018
Messages
78
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
648
I am trying to understand what happens if we change priority in code in given link https://www.digikey.com/en/maker/pr...t-2-freertos/b3f84c9c9455439ca2dcb8ccfce9dec5

C:
//  task 1: blink an LED at one rate, Hight priority
void toggleLED_1(void *parameter) {
  while(1) {
    digitalWrite(led_pin, HIGH);
    vTaskDelay(rate_1 / portTICK_PERIOD_MS);  // blocking for 500ms
    digitalWrite(led_pin, LOW);
    vTaskDelay(rate_1 / portTICK_PERIOD_MS);  // blocking for 500ms
  }
}

// task 2: blink an LED at another rate, low priority
void toggleLED_2(void *parameter) {
  while(1) {
    digitalWrite(led_pin, HIGH);
    vTaskDelay(rate_2 / portTICK_PERIOD_MS); //blocking for  323ms
    digitalWrite(led_pin, LOW);
    vTaskDelay(rate_2 / portTICK_PERIOD_MS); //blocking for  323ms
  }
}
Here I start to think

Task 1 run because of high priority
Task 1 block for 500ms
Task 2 run because Task 1 is blocked
Task 2 block for 323 ms

Now stuck there I am looking help to figureout how both task execute over time
 

VTaskDelay stops the task that calls it but it does NOT block other tasks - in fact it can trigger the task scheduler to see if there is another task that can run.
The task priority only really kicks in when you have two tasks that ca run and then it picks the higher priority one.
Susan
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top