 |
Timing Control
|
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.
AMX provides three classes of timing services: task delays and timeouts, interval timers and a calendar clock.
A task can suspend itself for a specific interval. A task can also wait for an event which must occur before a specific interval. If the event fails to occur within the interval, the task resumes execution with a timeout indication.
User 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 expires, AMX executes a user Timer Procedure.
User 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.
AMX also provides time of day calendar support if required. AMX services are provided to set and read the calendar clock. A formatting function is also provided to translate the calendar time and date from the internal format in which it is maintained by AMX into an ASCII string in several of the most popular formats.
A user procedure can be tied to the calendar clock and called at one second intervals to permit simple time of day event scheduling.
|
Timing Control |
| Function |
Service |
| cjtmcreate |
Create a 32-bit interval timer |
| cjtmdelete |
Delete an interval timer |
| cjtmwrite |
Start/stop an interval timer |
| cjtmread |
Read an interval timer |
| cjtmconvert |
Convert milliseconds to system ticks |
| cjtmtick |
Read 32-bit unsigned wrap around clock tick |
| |
| cjtmtsopt |
Enable / disable time slicing |
| cjtmslice |
Change a task's time slice interval |
| |
| cjtdset |
Set calendar time/date |
| cjtdget |
Read calendar time/date |
| cjtdfmt |
Format calendar time/date as an ASCII string |
| |
Function timing values are provided on separate AMX data sheets for each target processor. |
|
|