AMX Timing Control
K
A
DAK
69
5. AMX Timing Control5.1 Introduction to Timing Facilities
Most real-time systems are characterized by the need to provide precise control over the
timing of activities. A hardware clock provides the timing source; AMX provides the
control over its use.
The unit of time in an AMX system is the system tick which is a fixed interval derived
from the hardware clock. The system tick interval is user selectable. Typically, it is set
at 10 ms or 100 ms. The system tick interval is chosen to provide the minimum
resolution required in a particular application without inflicting unnecessary timing
overhead.
Task Delays and Timeouts
A task can suspend itself for a specific interval. A task can also wait for an event which
must occur within a specific interval. If the event fails to occur within the interval, the
task resumes execution with a timeout indication.
Interval Timers
Application interval timers are the most general form of timer provided by AMX. Once
such a timer has been created, it can be started, interrogated and stopped by any task or
Interrupt Service Procedure. When a timer is created, an application dependent Timer
Procedure must be provided. Whenever the timer expires, AMX executes this Timer
Procedure passing it a parameter which was specified when the timer was created.
Application timers can also be periodic. The timer period is specified when the timer is
created. AMX calls the corresponding Timer Procedure periodically at the defined
interval.
The following AMX procedures provide interval timer services:
ajtmcnv AATMCNV Convert milliseconds to system ticks
ajtmcre AATMCRE Create an interval timer
ajtmdel AATMDEL Delete an interval timer
ajtmrd AATMRD Read an interval timer
ajtmtag AATMTAG Find timer id of timer with a specific tag
ajtmwr AATMWR Start/stop an interval timer