Chapter 9: Internal System Clock and Application Timers
9.1 Introduction
Fast response to asynchronous external events is the most important function of real- time, embedded applications. However, many of these applications must also perform certain activities at predetermined intervals of time.
ThreadX application timers enable you to execute application C functions at specific intervals of time. You can also set an application timer to expire only once. This type of timer is called a one-shot timer, while repeating interval timers are called periodic timers. Each application timer is a public resource.
Time intervals are measured by periodic timer interrupts. Each timer interrupt is called a timer-tick. The actual time between timer-ticks is specified by the application, but 10ms is the norm for many implementations. [38]
The underlying hardware must be able to generate periodic interrupts in order for application timers to function. In some cases, the processor has a built-in periodic interrupt capability. If not, the user s computer board must have a peripheral device that can generate periodic interrupts.
ThreadX can still function even without a periodic interrupt source. However, all timer-related processing is then disabled. This includes time-slicing, suspension time- outs, and timer services.
Timer expiration intervals are specified in terms of timer-ticks. The timer count starts at the specified expiration value and decreases by one on each timer-tick. Because an application timer could be enabled just prior to a timer interrupt (or timer-tick), the timer could expire up to one tick early.
If the timer-tick rate is 10ms, application timers may expire up to...