ARM Technical Support Knowledge Articles

USING INTERVAL AND FIXED WAIT TIMES

Applies to: Advanced RTOS

Answer


Information in this article applies to:


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

Article last edited on: 2005-05-09 17:15:36

Rate this article

[Bad]
|
|
[Good]
Disagree? Move your mouse over the bar and click

Did you find this article helpful? Yes No

How can we improve this article?

Link to this article
Copyright © 2011 ARM Limited. All rights reserved. External (Open), Non-Confidential