
64
3-6
Advanced Programming
3-6-1
Interlocks
When an instruction line branches into two or more lines, it is sometimes
necessary to use interlocks to maintain the execution condition that existed
at a branching point. This is because instruction lines are executed across to
a right-hand instruction before returning to the branching point to execute
instructions one a branch line. If a condition exists on any of the instruction
lines after the branching point, the execution condition could change during
this time making proper execution impossible. The following diagrams illus-
trate this. In both diagrams, instruction 1 is executed before returning to the
branching point and moving on to the branch line leading to instruction 2.
Instruction 1
0002
0000
Instruction 2
Branching
point
Instruction 1
0002
0000
Instruction 2
Branching
point
Diagram B: Incorrect Operation
Diagram A: Correct Operation
0001
Address
Instruction
Operands
000
LD
0000
001
Instruction 1
002
AND
0002
003
Instruction 2
Address
Instruction
Operands
000
LD
0000
001
AND
0001
002
Instruction 1
003
AND
0002
004
Instruction 2
If, as shown in diagram A, the execution condition that existed at the branch-
ing point cannot be changed before returning to the branch line (instructions
at the far right do not change the execution condition), then the branch line
will be executed correctly and no special programming measure is required.
If, as shown in diagram B, a condition exists between the branching point
and the last instruction on the top instruction line, the execution condition at
the branching point and the execution condition after completing the top in-
struction line will sometimes be different, making it impossible to ensure cor-
rect execution of the branch line.
The problem of storing execution conditions at branching points can be han-
dled by using the INTERLOCK (IL(02)) and INTERLOCK CLEAR (ILC(03))
instructions to eliminate the branching point completely while allowing a spe-
cific execution condition to control a group of instructions. The INTERLOCK
and INTERLOCK CLEAR instructions are always used together.
When an INTERLOCK instruction is placed before a section of a ladder pro-
gram, the execution condition for the INTERLOCK instruction will control the
execution of all instruction up to the next INTERLOCK CLEAR instruction. If
the execution condition for the INTERLOCK instruction is OFF, timers will be
reset; counters, shift registers, and the KEEP instruction will be frozen (i.e.,
their operands and present values will not change); and all other instructions
will be ignored through the next INTERLOCK CLEAR instruction.
To create an interlocked program section, the conditions leading up to the
branching point (i.e., the ones that are to control the interlocked section) are
placed on an instruction line for the INTERLOCK instruction, all of lines lead-
ing from the branching point are written as separate instruction lines, and
another instruction line is added for the INTERLOCK CLEAR instruction. No
conditions are allowed on the instruction line for INTERLOCK CLEAR. Nei-
ther INTERLOCK nor INTERLOCK CLEAR requires an operand.
Advanced Programming
Section 3-6