Clocks and Timers

Real-time systems require several operating system timing services. The operating system must be able to accurately account for the passage of time, schedule threads at precise times, and suspend threads at precise intervals.

The wRTOS clock and timer facilities provide the services necessary for threads to perform periodic tasks that correspond with the external passage of time.

Timers are associated with a clock in the system - against which a timer's expiration is measured - when they are created. A timer begins to count down to its expiration after having been set. Once the timer has expired, the handling thread is executed, and the timer is automatically rearmed if necessary. A Timer can be set to execute its handling routine only once and is referred to as a “one-shot” timer, or it can be set to execute its handling routine on an ongoing periodic basis, which is referred to as a "repeat" or "interval" timer.

Note: Timer periods must be set to a multiple of the value that the HAL timer period is set to in the wRTOS Settings.

In addition to clocks and timers, wRTOS provides sleep services that let you suspend the current thread for a specified time.

Topics: