RTX51 TINY: DIFFERENCE BETWEEN INTERVAL AND TIMEOUT
Information in this article applies to:
What's the difference between the K_IVL and K_TMO events in the os_wait function call? The documentation is not clear about these two events.
The K_TMO event lets you specify a number of OS ticks to delay. The K_IVL event lets you specify an interval to delay.
An example will illustrate the differences between these two. Let's assume that the RTX51 tick is set for a period of 1 msec.
The K_TMO event delays for at least the number of OS ticks you specify. For example, if you have a task that loops through code that takes 5 msec to execute, calls os_wait(K_TMO...) with a tick count of 10, and repeats; the whole loop executes in 15 msec (5 msec for the code and 10 msec for the K_TMO).
The K_IVL event delays for a period of time that is at least the time that you specify minus the number of ticks that have elapsed since the last K_IVL event. For example, if you have a task that loops through code that takes 6 msec to execute, calls os_wait(K_IVL...) with a tick count of 10, and repeats; the whole loop executes in 10 msec (6 msec for the code and 4 msec for the K_IVL).
Use the K_TMO event when you need/want to delay a task for a few milliseconds. Use the K_IVL event when you need a task to execute on a specific periodic basis.
Remember that the number of ticks passed to the os_wait function MUST be an unsigned character and, therefore, must have a value of 255 or less.
Last Reviewed: Sunday, July 17, 2005
of your data.