MQX Lite tasks run only one time and stop !

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MQX Lite tasks run only one time and stop !

Jump to solution
830 Views
nexcode
Contributor II

Hi, I'm new on MQX and making a test, I made a project with two tasks, on a KL25Z - Arm M0 Freedom Board. The first and the second task only blink a LED.

Red for Task 1 and Blue for task 2, using a simple delay routine.

These two tasks only run at a first time and do not repeat.

I was wainting Task1, Task 2 and Task 1... again and repeat it forever.

I made many changes, but nothing change this ?

If I make only one task, it repeat, but do why with more than one  do not?

I use codewarrior 10.4.

Original Attachment has been moved to: Exercicio2.rar.zip

1 Solution
359 Views
deepakrana
NXP Employee
NXP Employee

hi

in the task whatever you want to must be in a while(1) loop.

// task 1 while 1 loop

while(1) {

    counter++;

   _time_delay_ticks(50);

    /* Write your code here ... */

  }

// task 2 while 1 loop

while(1) {

    counter++;

    RED_NegVal(NULL);

    _time_delay_ticks(250);

    /* Write your code here ... */

  }

Note: Lite only support FIFO scheduling , we are using the _time_delay_ticks to block the task.

In this case taks 1 and task2 will called again and again and they will be time delay block for the number of ticks mentioned in the API called for.

Hope this helps

View solution in original post

0 Kudos
1 Reply
360 Views
deepakrana
NXP Employee
NXP Employee

hi

in the task whatever you want to must be in a while(1) loop.

// task 1 while 1 loop

while(1) {

    counter++;

   _time_delay_ticks(50);

    /* Write your code here ... */

  }

// task 2 while 1 loop

while(1) {

    counter++;

    RED_NegVal(NULL);

    _time_delay_ticks(250);

    /* Write your code here ... */

  }

Note: Lite only support FIFO scheduling , we are using the _time_delay_ticks to block the task.

In this case taks 1 and task2 will called again and again and they will be time delay block for the number of ticks mentioned in the API called for.

Hope this helps

0 Kudos