Technical Support

RTX166 TINY: DIFFERENCE BETWEEN K_IVL AND K_TMO


Information in this article applies to:

  • C166 Version 3.12
  • C166 Version 4.06

QUESTION

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.

ANSWER

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 int and, therefore, must have a value of 65535 or less.

Last Reviewed: Tuesday, October 24, 2000


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