AMX 86 Frozen Dessert Maker User Manual


 
AMX Timing Control
K
A
DAK
75
5.3 Interval Timers and Timer Procedures
AMX supports any number of application interval timers in a system. The maximum
number in a system is defined in your System Configuration Module (see Chapter 14.5).
A timer must be created by an application before it can be used. Restart Procedures,
tasks, ISPs and Timer Procedures can create timers. It is recommended that only Restart
Procedures and tasks be used to create timers.
AMX procedure ajtmcre is used to create a timer. AMX allocates a timer and returns a
timer id to the caller. The timer id is a handle which uniquely identifies the particular
timer allocated for use by the application. It is the responsibility of the application to
keep track of the timer id for future reference to the timer.
When a timer is created, you can provide a unique 4-character tag to identify the timer.
The tag can be used subsequently in a call to
ajtmtag to find the timer id allocated by the
Timer Manager to the particular timer.
When a timer is created, the caller must also specify the following parameters: the timer
period, a pointer to an application Timer Procedure and an optional 32-bit application
dependent parameter.
The timer period determines if the timer is periodic. If the timer period is zero, the timer
is a one-shot timer. Whenever a one-shot timer is started, it runs until it expires at which
time it remains idle until started again.
If the timer period is non-zero, the timer is periodic. The period specifies the timer's
period measured in AMX system ticks.
Whenever a timer expires, the AMX Kernel Task executes the Timer Procedure which
was provided when the timer was created. The Timer Procedure receives the timer id and
the predefined 32-bit application parameter as parameters.
When a timer is created, AMX sets the timer idle. The timer remains idle until it is
started by a Restart Procedure, task, ISP or Timer Procedure. Timers are started by
calling AMX procedure
ajtmwr to write the initial timer interval into the timer.
Timer intervals are measured in multiples of system ticks. For convenience, the AMX
procedure
ajtmcnv can be used to convert a period specified in milliseconds to the
corresponding number of system ticks.
Timers are down-counters. When a timer expires, the AMX Kernel Task calls the timer's
Timer Procedure. One-shot timers remain expired unless they are restarted by their
Timer Procedure. Periodic timers are automatically restarted by the AMX Kernel Task
with their predefined timer period before the timer's Timer Procedure has been executed.
When an interval timer is no longer needed, it can be deleted with a call to
ajtmdel.