10
K
A
DAK
General AMX Operation
Alarm scanning will likely be hardware dependent. We will simplify matters by
assuming that a scanning task must examine all digital inputs every 100 ms. The task
must be capable of detecting alarm changes in the digital inputs. When an alarm is
detected, the scanning task must initiate the logging of a message.
However, the scanning task is not allowed the luxury of waiting until the message is
printed. It must continue scanning for additional alarms at the same 100 ms rate. The
scanning task must, therefore, send to the message task parameters identifying the alarm
which has occurred and the time at which it was detected.
The message task is very simple to describe. It receives parameters identifying the time
at which a particular alarm occurred. The task must output to a printer a message
describing the alarm.
The foregoing example, although very simple, illustrates many of the features of a real-
time multitasking system. At first, the implementation of the required set of tasks may be
difficult to envision. Two of the tasks must operate periodically at different intervals.
The third task, printing, is such a slow process that the other two tasks must be allowed to
execute with higher priority. Moreover, provision must be made to allow the alarm
parameters to continue piling up on the message task when alarms are occurring at a rate
faster than can be printed. (What would we do if we had to print high priority alarms first
and delay the printing of lower priority alarms?)
The implementation of the proposed solution is greatly simplified by AMX. AMX will
supervise the execution of the three tasks in the defined priority order. Timing facilities
are provided by AMX with a resolution governed by the hardware clock. AMX supports
message passing between tasks. AMX allows these messages to pile up at the destination
task at any of four priority levels because automatic message queuing with priority
sorting is an inherent feature of AMX.
This introduction to multitasking is not exhaustive. The intent is to remove some of the
mystery from the multitasking concept. The above example is intended to inspire
confidence in your ability to understand AMX and use it to solve real-time problems.