MQX Lite tasks run only one time and stop !

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

MQX Lite tasks run only one time and stop !

跳至解决方案
904 次查看
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 解答
433 次查看
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 项奖励
回复
1 回复
434 次查看
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 项奖励
回复