omron — REACT program instruction

REACT program instruction transitions properly. priority Optional real-valued expression that indicates the relative importance of this reaction as explained below. The value of this expression is interpreted as an integer value and can range from 1 to 127. See the LOCK instruction for additional details on priority values. The default value is 1. Details When the specified signal transition is detected, eV+ reacts by checking the priority specified with the REACT instruction against the program priority setting at that time. (The program priority is always set to 0 when execution begins.

It can be changed with the LOCK instruction.) If the REACT priority is greater than the program priority, the normal program execution sequence is interrupted and the equivalent of a CALL program instruction is executed. Also, the program priority is temporarily raised to the REACT priority, locking out any reactions of equal or lower importance. When a RETURN instruction is executed in a reaction subroutine, the program priority is restored to the value it had before the reaction program was invoked. If the REACT priority is less than or equal to the program priority when the signal transition is detected, the reaction is queued and does not occur until the program priority is lowered.

Therefore, depending upon the relative priorities, there can be a considerable delay between the time a signal transition is noticed by eV+ and the time the reaction program is actually invoked. If multiple reactions are pending because of a priority lockout, the reaction with the highest priority is serviced first when the locking priority is lowered. If multiple pending reactions have the same priority, the one associated with the highest signal number is processed first.

The subroutine call to program is performed such that when a RETURN instruction is encountered, the next instruction to be executed is the one that follows the last instruction processed before the reaction program was initiated. If there is a sequence of instructions that you do not want interrupted by a reaction program, you should use the LOCK instruction to raise the program priority during that sequence. The signal monitoring continues until one of the following occurs: l An IGNORE instruction is executed for the signal. l A reaction occurs (in which case IGNORE signal_num is automatically performed). l A REACT (or REACTI) instruction is executed that refers to the same signal.

That is, if the signal specified in a REACT instruction is already being monitored by a previous REACT or REACTI instruction, the old instruction is canceled when the new REACT instruction is executed. eV+Language Reference Guide, v2.x, 18319-000 Rev A Page 418