ARM Technical Support Knowledge Articles

DIFFERENCE BETWEEN INTERVAL AND TIMEOUT

Applies to: RTX51 Tiny Real-time Kernel

Answer


Information in this article applies to:


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

MORE INFORMATION

Article last edited on: 2005-07-17 11:13:48

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