<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/24607/how-to-modify-this-programe-to-see-the-difference-between-timeout-and-interval</link><description> 
#include &amp;quot;rtx51tny.h&amp;quot; 
#include &amp;quot;REG935.H&amp;quot; 

 
const unsigned char
table[]={0x01,0x02,0x04,0x08,0x10,0x20,0x40,0x80
,0x40,0x20,0x10,0x08,0x04,0x02,0x01,0xFF,0x00}; 

 
int counter0; 
int counter1; 
int counter2; 
int counter3; 

 
void LED0 (void) _task_</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/151324?ContentTypeID=1</link><pubDate>Sun, 04 Oct 2009 13:11:21 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:34d471d9-55a8-464b-aaeb-f91af23f9f2a</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
Result of using a periodic timer with value 5 ticks, and having
code that takes 3 ticks to execute:&lt;/p&gt;

&lt;pre&gt;
|xxx  |xxx  |xxx  |
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
Result of using a delay with value 5 ticks, and having code that
takes 3 ticks to execute:&lt;/p&gt;

&lt;pre&gt;
|xxx     |xxx     |xxx     |
&lt;/pre&gt;

&lt;p&gt;
Changing the delay to 2 ticks, would compensate:&lt;/p&gt;

&lt;pre&gt;
|xxx  |xxx  |xxx  |
&lt;/pre&gt;

&lt;p&gt;
&lt;br /&gt;
But what happens if the code takes 1 to 3 ticks randomly, and you try
to compensate with a 2 tick delay?&lt;/p&gt;

&lt;pre&gt;
|x  |xxx  |xx  |xxx  |x  |
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/146450?ContentTypeID=1</link><pubDate>Sun, 04 Oct 2009 05:00:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:0eb6e3af-557c-4859-a393-6670983fbd68</guid><dc:creator>hero0765 maxwell</dc:creator><description>&lt;p&gt;&lt;p&gt;
hi: I have read manual about them. But I have not been
comprehensible to this sentence: &lt;b&gt;The Interval is a variation of
the Timeout. An interval is like a timeout except that the specified
number of clock ticks is relative to the last time the os_wait
function was invoked by the task.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
It means that the interval is a timeout in the normal state , but
which state the interval will not behaved like timeout?&lt;/p&gt;

&lt;p&gt;
In your little programe, the interval didnot behave like
timeout.&lt;/p&gt;

&lt;pre&gt;
  while (1)
  {
    wait(5s); // timeout or interval
    executeFunction(); // takes 2s to execute
    sendSignal(); // send a signal e.g. toggle LED
  }


&lt;/pre&gt;

&lt;p&gt;
But in my programe ,the interval did behave like timeout.&lt;/p&gt;

&lt;pre&gt;
    while (1)    {
    os_wait (K_IVL, 200, 0);//wait  interval for 2s
    os_wait (K_TMO, 100, 0);//wait  timeout for 1s
    os_send_signal (1);

    }

&lt;/pre&gt;

&lt;p&gt;
your programe is in this condition:&lt;/p&gt;

&lt;p&gt;
&lt;i&gt;except that the specified number of clock ticks is relative to
the last time the os_wait function was invoked by the task.&lt;/i&gt;&lt;/p&gt;

&lt;p&gt;
isn&amp;#39;t is?&lt;/p&gt;

&lt;p&gt;
why?&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/144735?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2009 23:45:37 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:651cea70-4609-4c34-a5a8-8340c59c9990</guid><dc:creator>Stefan Hartwig</dc:creator><description>&lt;p&gt;&lt;p&gt;
It seems like you do not want to read the manuals:&lt;br /&gt;
&lt;b&gt;The Interval is a variation of the Timeout. An interval is like a
timeout except that the specified number of clock ticks is
&lt;i&gt;relative to the last time the os_wait function was invoked&lt;/i&gt; by
the task.&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;
Maybe its a good idea to use interval and timeout in the same
task...&lt;/p&gt;

&lt;p&gt;
By the way: In RL-ARM it is explicitly forbidden to intermix
interval and delay/timeout wait functions.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/142454?ContentTypeID=1</link><pubDate>Thu, 01 Oct 2009 20:21:50 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:70424b8c-761c-4454-b603-95caa6054fa1</guid><dc:creator>hero0765 maxwell</dc:creator><description>&lt;p&gt;&lt;p&gt;
hi: &lt;i&gt;Stefan Hartwig&lt;/i&gt;,I doubt your Little example&lt;/p&gt;

&lt;pre&gt;

  while (1)
  {
    wait(5s); // timeout or interval
    executeFunction(); // takes 2s to execute
    sendSignal(); // send a signal e.g. toggle LED
  }

&lt;/pre&gt;

&lt;p&gt;
Because I make an experiment by following little programe:&lt;/p&gt;

&lt;pre&gt;
    while (1)    {
    os_wait (K_IVL, 200, 0);//wait  interval for 2s
    os_wait (K_TMO, 100, 0);//wait  timeout for 1s
    os_send_signal (1);

    }
&lt;/pre&gt;

&lt;p&gt;
my result is that the signal will be send every 3s&lt;br /&gt;
(2s wait for interval + 1s wait for timeout).The result is not that
as my prediction:the signal will be send every 2s(1s wait for
interval + 1s wait for timeout). the result is the same as following
programe:&lt;/p&gt;

&lt;pre&gt;
    while (1)    {
    os_wait (K_TMO, 200, 0);//wait  timeout for 2s
    os_wait (K_TMO, 100, 0);//wait  timeout for 1s
    os_send_signal (1);

    }
&lt;/pre&gt;

&lt;p&gt;
So , I still can not express the difference between tbem in
programe.The reality is contrary to the theory .&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/139330?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2009 01:52:21 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:d6f7ff3a-894e-45e0-9de5-f20a5108efdb</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Yes, that&amp;#39;s true - that is why it is so important that you pay
attention to the &lt;b&gt;Preview &lt;i&gt;before&lt;/i&gt;&lt;/b&gt; you post the
message!&lt;/p&gt;

&lt;p&gt;
Now, you&amp;#39;ll just have to re-post it: as a &lt;b&gt;Reply&lt;/b&gt; in this
thread - &lt;i&gt;&lt;b&gt;not&lt;/b&gt;&lt;/i&gt; as another new thread!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/130534?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2009 01:39:00 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:82dd1dda-8e99-43ea-bee2-faab21e79626</guid><dc:creator>hero0765 maxwell</dc:creator><description>&lt;p&gt;&lt;p&gt;
thanks &lt;i&gt;Stefan Hartwig&lt;/i&gt; and &lt;i&gt;Per Westermark&lt;/i&gt;&lt;br /&gt;
help! when the message have been posted,I can not edit it again even
if I find the error.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/125738?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2009 01:08:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:824f36a7-2049-40df-9f44-613d76ccbaf8</guid><dc:creator>Stefan Hartwig</dc:creator><description>&lt;p&gt;&lt;p&gt;
I don&amp;#39;t have time to test your code, but I think the differences
are well documented.&lt;/p&gt;

&lt;p&gt;
Timeout 5s means: the task waits for 5s&lt;br /&gt;
Interval 5s means: the task executes every 5s independent of its
execution time&lt;/p&gt;

&lt;p&gt;
Little example in pseudo code:&lt;/p&gt;

&lt;pre&gt;
while (1)
{
    wait(5s); // timeout or interval
    executeFunction(); // takes 2s to execute
    sendSignal(); // send a signal e.g. toggle LED
}
&lt;/pre&gt;

&lt;p&gt;
If you use timeout, the signal will be send every 7s (5s wait + 2s
execution). If you use interval, the signal will be send every 5s (3s
wait and 2s execution).&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/125733?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2009 01:04:52 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7469aaa1-84fa-43ca-9cdb-a608e79685ea</guid><dc:creator>ImPer Westermark</dc:creator><description>&lt;p&gt;&lt;p&gt;
You didn&amp;#39;t pay attention to your question either. If you did, you
would have posted the source code formatted as source code, and not
just inlined with the text.&lt;/p&gt;

&lt;p&gt;
If you had payed attention, your code would have looked
like:&lt;/p&gt;

&lt;pre&gt;
#include &amp;lt;stdio.h&amp;gt;

int main(void) {
    printf(&amp;quot;Hello world!\n&amp;quot;);
    return 0;
}
&lt;/pre&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/115260?ContentTypeID=1</link><pubDate>Wed, 30 Sep 2009 00:52:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:8ec793e5-f90d-42a0-beec-6c40159ed376</guid><dc:creator>hero0765 maxwell</dc:creator><description>&lt;p&gt;&lt;p&gt;
No one pay attention to my question sincerely.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/103463?ContentTypeID=1</link><pubDate>Tue, 29 Sep 2009 00:43:43 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:268bea8a-76b7-4e78-9397-e8b89b8bf2a0</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;p&gt;
Simply repeating the question won&amp;#39;t help that!&lt;/p&gt;

&lt;p&gt;
In fact, if you just repeat the exact same question
&lt;i&gt;verbatim&lt;/i&gt;, it very much suggests that you haven&amp;#39;t put in any
more of your own effort - and that is likely to make people
&lt;i&gt;less&lt;/i&gt; likely to help.&lt;/p&gt;

&lt;p&gt;
If you don&amp;#39;t get a reply, the best way to improve your chances is
to give additional information and/or shown that you&amp;#39;ve given the
matter some thought.&lt;/p&gt;

&lt;p&gt;
Remember, you are getting help for free - nobody is getting paid
just to sit around waiting for questions, and then go away and
look-up answers for you.&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/101947?ContentTypeID=1</link><pubDate>Tue, 29 Sep 2009 00:39:02 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:58b5d123-99a1-4630-b7fe-88e9084158ec</guid><dc:creator>Stefan Hartwig</dc:creator><description>&lt;p&gt;&lt;p&gt;
If you start new threads over and over you can be &lt;b&gt;sure&lt;/b&gt;,
that no one will reply...&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/77785?ContentTypeID=1</link><pubDate>Tue, 29 Sep 2009 00:32:38 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b92b3ab3-3b8c-4181-9ed4-6023c37664cc</guid><dc:creator>hero0765 maxwell</dc:creator><description>&lt;p&gt;&lt;p&gt;
I afraid that no one replys me!&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to modify this programe to see the difference between timeout and interval</title><link>https://community.arm.com/thread/56917?ContentTypeID=1</link><pubDate>Mon, 28 Sep 2009 22:50:05 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:50ccc6b9-c3a3-49ff-bcac-4d95008f1f29</guid><dc:creator>Stefan Hartwig</dc:creator><description>&lt;p&gt;&lt;p&gt;
&lt;b&gt;Why starting a new task?&lt;/b&gt;&lt;br /&gt;
&lt;a href="http://www.keil.com/forum/docs/thread15625.asp"&gt;http://www.keil.com/forum/docs/thread15625.asp&lt;/a&gt;&lt;/p&gt;
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>