<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>MQX Software Solutions中的主题 How to create 2 MQX timers at different priority levels?</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-create-2-MQX-timers-at-different-priority-levels/m-p/264898#M7936</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I currently create a timer like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lError = _timer_create_component(3, 1024);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Timer component at priority(3) with a 1K stack&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(lError == MQX_OK)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer_5ms = _timer_start_periodic_every(INT_1msTimer, 0, TIMER_ELAPSED_TIME_MODE, 5);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I want a second timer at a different priority, I don't think I can do this?:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lError = _timer_create_component(2, 8192);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Timer component at priority(2) with a 8K stack&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(lError == MQX_OK)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer_100ms = _timer_start_periodic_every(INT_100msTimer, 0, TIMER_ELAPSED_TIME_MODE, 100);&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;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!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;~Tim&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 10 Jul 2013 19:15:49 GMT</pubDate>
    <dc:creator>Tim562</dc:creator>
    <dc:date>2013-07-10T19:15:49Z</dc:date>
    <item>
      <title>How to create 2 MQX timers at different priority levels?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-create-2-MQX-timers-at-different-priority-levels/m-p/264898#M7936</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I currently create a timer like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lError = _timer_create_component(3, 1024);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Timer component at priority(3) with a 1K stack&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(lError == MQX_OK)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer_5ms = _timer_start_periodic_every(INT_1msTimer, 0, TIMER_ELAPSED_TIME_MODE, 5);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I want a second timer at a different priority, I don't think I can do this?:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lError = _timer_create_component(2, 8192);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //Timer component at priority(2) with a 8K stack&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(lError == MQX_OK)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; timer_100ms = _timer_start_periodic_every(INT_100msTimer, 0, TIMER_ELAPSED_TIME_MODE, 100);&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;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!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;~Tim&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Jul 2013 19:15:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-create-2-MQX-timers-at-different-priority-levels/m-p/264898#M7936</guid>
      <dc:creator>Tim562</dc:creator>
      <dc:date>2013-07-10T19:15:49Z</dc:date>
    </item>
  </channel>
</rss>

