MQX Lite tasks run only one time and stop !

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

MQX Lite tasks run only one time and stop !

ソリューションへジャンプ
905件の閲覧回数
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 解決策
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 件の賞賛
返信
1 返信
435件の閲覧回数
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 件の賞賛
返信