| |||||
Technical Support Support Resources
Product Information | ARTX: USING INTERVAL AND FIXED WAIT TIMESInformation in this article applies to:
QUESTIONIs 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? ANSWERIt 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
FORUM THREADSThe following Discussion Forum threads may provide information related to this topic. Last Reviewed: Monday, May 09, 2005 | ||||
| |||||