<?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 a cyclic task in MQX</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-create-a-cyclic-task-in-MQX/m-p/443144#M14803</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a simple way of creating a cyclic task in MQX?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The _time_delay(xx) function isn't really what I'm looking for since it doesn't take into account the execution time of the task. So, with this delay function, if I want a 5 ms cyclic task for example and this task takes 1 ms to execute, my task would be executed every 6 ms and not 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we take the same example above, what I would like is that 4 ms after execution of the task (which last 1 ms), the task would become ready again. I could just call _time_delay(4) but the execution time of the task isn't constant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I though about creating a task queue and a lwtimer event queue with a lwtimer that calls a callback function when it expires. This callback would simply call _taskq_resume(). At the end of the task execution the task would call _taskq_suspend().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems complicated just to do something that should be very simple. Is there another way and simpler way of doing this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 30 Jun 2015 14:31:20 GMT</pubDate>
    <dc:creator>hbouch</dc:creator>
    <dc:date>2015-06-30T14:31:20Z</dc:date>
    <item>
      <title>How to create a cyclic task in MQX</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-create-a-cyclic-task-in-MQX/m-p/443144#M14803</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Is there a simple way of creating a cyclic task in MQX?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The _time_delay(xx) function isn't really what I'm looking for since it doesn't take into account the execution time of the task. So, with this delay function, if I want a 5 ms cyclic task for example and this task takes 1 ms to execute, my task would be executed every 6 ms and not 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If we take the same example above, what I would like is that 4 ms after execution of the task (which last 1 ms), the task would become ready again. I could just call _time_delay(4) but the execution time of the task isn't constant.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I though about creating a task queue and a lwtimer event queue with a lwtimer that calls a callback function when it expires. This callback would simply call _taskq_resume(). At the end of the task execution the task would call _taskq_suspend().&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It seems complicated just to do something that should be very simple. Is there another way and simpler way of doing this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 30 Jun 2015 14:31:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-create-a-cyclic-task-in-MQX/m-p/443144#M14803</guid>
      <dc:creator>hbouch</dc:creator>
      <dc:date>2015-06-30T14:31:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a cyclic task in MQX</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-create-a-cyclic-task-in-MQX/m-p/443145#M14804</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Hugo,&lt;/P&gt;&lt;P&gt;It has been long time since I implemented something like this so please refer to the following PDF:&lt;/P&gt;&lt;P&gt;C:\Freescale\Freescale_MQX_4_1_1\doc\mqx\MQX_Reference_Manual.pdf&lt;/P&gt;&lt;P&gt;Search for "_timer_start_" for various implementations.&lt;/P&gt;&lt;P&gt;Your implementation might want to use:&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_macro_code _jivemacro_uid_14356773063706070 jive_text_macro" data-renderedposition="113_8_927_112" jivemacro_uid="_14356773063706070"&gt;&lt;P&gt;source\kernel\timer.c&lt;/P&gt;&lt;P&gt;#include &amp;lt;timer.h&amp;gt;&lt;/P&gt;&lt;P&gt;_timer_id _timer_start_oneshot_after(&lt;/P&gt;&lt;P&gt;TIMER_NOTIFICATION_TIME_FPTR notification_function,&lt;/P&gt;&lt;P&gt;void *notification_data_ptr,&lt;/P&gt;&lt;P&gt;_mqx_uint mode,&lt;/P&gt;&lt;P&gt;uint32_t milliseconds)&lt;/P&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My example is from MQX3.8 so check that it matches current PDF:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="ScreenHunter_163 Jun. 30 10.19.gif"&gt;&lt;IMG alt="ScreenHunter_163 Jun. 30 10.19.gif" src="https://community.nxp.com/t5/image/serverpage/image-id/61081iA2653C47EB97E23A/image-size/large?v=v2&amp;amp;px=999" title="ScreenHunter_163 Jun. 30 10.19.gif" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 13:21:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-create-a-cyclic-task-in-MQX/m-p/443145#M14804</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2020-11-02T13:21:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to create a cyclic task in MQX</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-create-a-cyclic-task-in-MQX/m-p/443146#M14805</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You're right, "_timer_start_" seems simpler. I looked at MQX reference manual and I think using "_timer_start_periodic_every" would be best suited for me. I could also use "_task_ready" as notification function and task descriptor pointer as pointer to the data that MQX passes to the notification function. At the end of my tasks I would need to use "_task_block".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I will try that thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Hugo&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 01 Jul 2015 08:07:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/How-to-create-a-cyclic-task-in-MQX/m-p/443146#M14805</guid>
      <dc:creator>hbouch</dc:creator>
      <dc:date>2015-07-01T08:07:21Z</dc:date>
    </item>
  </channel>
</rss>

