Keil™, An ARM® Company

Technical Support

RTX51: OS_WAIT DOESN'T DELAY FOR SPECIFIED TIME

QUESTION

I call an os_wait library routine as follows:

os_wait (K_TMO, 1000, NULL);

but it returns before the specified number of ticks have elapsed. What's going on?

ANSWER

The problem is that the 1000 is being implicitly cast to an 8-bit value. If you need to delay more than 255 ticks, you must use multiple calls to os_wait. You should replace your above code with the following:

os_wait (K_TMO, 250, NULL);
os_wait (K_TMO, 250, NULL);
os_wait (K_TMO, 250, NULL);
os_wait (K_TMO, 250, NULL);

This delays the task for 1000 ticks.

Last Reviewed: Monday, June 07, 2004


Did this article provide the answer you needed?
 
Yes
No
Not Sure