Keil Logo

ARTX: USING INTERVAL AND FIXED WAIT TIMES


Information in this article applies to:

  • ARTX-ARM All Versions
  • ARTX-166 All Versions

QUESTION

Is it possible to use both os_itv_wait() and os_dly_wait() in the same task?

In the following example, it looks like the interval time from os_itv_set () is modified by argument of the os_dly_wait() call.

void task2 (void) _task_ 1 {

  os_itv_set(100);

  while (1)  {
    os_itv_wait ();                  // start task every 100 ticks
       :                             // some code
    os_dly_wait (10);                // wait here for 10 ticks
       :                             // some more code
  }
}

How can I overcome this behavior?

ANSWER

It is not possible to mix the wait method os_itv_wait and os_dly_wait(). Advanced RTX maintains only one timer per task and therefore os_dly_wait() overwrites the interval value that has been set by os_itv_set (). However, you may overcome this problem by using the following technique:

void task1 (void) _task_ 1 {
  while (1)  {
    os_evt_wait_or (0x0001, 0xffff); // wait for event flag set
       :                             // some code
    os_dly_wait (10);                // wait here for 10 ticks
       :                             // some more code
  }
}

void task2 (void) _task_ 2 _priority_ 1 {

  os_itv_set(100);

  while (1)  {
    os_itv_wait ();                  // start task every 100 ticks
    os_evt_set (0x0001, id1);        // send event to task 1
  }
}

MORE INFORMATION

  • Refer to the Function Reference in the Advanced Real-Time OS User's Guide

FORUM THREADS

The following Discussion Forum threads may provide information related to this topic.

Last Reviewed: Monday, May 9, 2005


Did this article provide the answer you needed?
 
Yes
No
Not Sure
 
  Arm logo
Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

Change Settings

Privacy Policy Update

Arm’s Privacy Policy has been updated. By continuing to use our site, you consent to Arm’s Privacy Policy. Please review our Privacy Policy to learn more about our collection, use and transfers
of your data.