User`s guide

Additional Program Interrupt Instructions
You can specify a parameter in the instruction line for the I/O instructions ATTACH, READ,
GETC, and WRITE that causes the program to suspend until the I/O request has been
successfully completed.
Third-party boards may also generate system level interrupts. For details, see the
descriptions of INT.EVENT, CLEAR.EVENT and WAIT.EVENT in Summary of Program Control
Keywords on page 136.
Program Interrupt Example
The following figure shows how the task and program priority scheme works. It also shows
how the asynchronous and program interrupt instructions work within the priority scheme.
The example makes the following assumptions:
l Task 1 runs in all time slices at priority 30
l Task 2 runs in all time slices at priority 20
l All system tasks are ignored
l All system interrupts are ignored
The illustration shows the time lines of executing programs. A solid line indicates a program
is running, and a dotted line indicates a program is waiting. The Y axis shows the program
priority. The X axis is divided into 16-millisecond major cycles. The example shows two tasks
executing concurrently with REACT routines enabled for each task. Note how the LOCK
instructions and triggering of the REACT routines change the program priority.
The sequence of events for the example is:
1. Task 1 is running program prog_a at program priority 0. A reaction program based on
signal 1003 is enabled at priority 5.
2. Signal 1003 is asserted externally. The signal transition is not detected until the next
major cycle.
3. The signal 1003 transition is detected. The task 1 reaction program begins execution,
interrupting prog_a.
4. The task 1 reaction program reenables itself and completes by issuing a RETURN
instruction. prog_a resumes execution in task 1.
5. Task 1 prog_a issues a CLEAR.EVENT instruction followed by a WAIT.EVENT
instruction to wait for its event flag to be set. Task 1 is suspended, and task 2 resumes
execution of prog_b. Task 2 has a reaction program based on signal 1010 enabled at
priority 5.
6. Task 2 prog_b issues a LOCK 10 instruction to raise its program priority to level 10.
7. Signal 1010 is asserted externally. The signal transition is not detected until the next
Program Interrupt Instructions
(Undefined variable: Primary.Product_Name_V)Language User's Guide, version
17.x
Page 125