How to create 2 MQX timers at different priority levels?

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

How to create 2 MQX timers at different priority levels?

1,600件の閲覧回数
Tim562
Senior Contributor I

Hi All,

     I'm trying to create to separate timers that run at different priority levels so that the higher priority level timer can preempt the lower priority one. I use a 100mS timer to do very quick chores (like servicing some leds and some counters) and I use a 5mS timer to do a chore that could take some time to complete. I would like the 100mS timer interrupt to preempt the 5mS timer so leds blink at a consistent rate and counters are serviced at a consistent rate.

I currently create a timer like this:

     lError = _timer_create_component(3, 1024);     //Timer component at priority(3) with a 1K stack

     if(lError == MQX_OK)

          timer_5ms = _timer_start_periodic_every(INT_1msTimer, 0, TIMER_ELAPSED_TIME_MODE, 5);

If I want a second timer at a different priority, I don't think I can do this?:

     lError = _timer_create_component(2, 8192);     //Timer component at priority(2) with a 8K stack

     if(lError == MQX_OK)

          timer_100ms = _timer_start_periodic_every(INT_100msTimer, 0, TIMER_ELAPSED_TIME_MODE, 100);

But, if I just call _timer_start_periodic_every() a second time without creating a new component I would get a second timer at the same priority as the first timer right? But creating 2 timer components is not correct right? So what would be the proper way to do this? Thanks for suggestions!

~Tim

タグ(3)
0 件の賞賛
0 返答(返信)