180 Chapter 9 Program Control Instructions
MCR-controlled areas must contain only two MCR
instructions—one to de ne the start and one to de ne the
end. Never overlap or nest MCR zones. Any additional
MCR instructions, or a jump instruction programmed
to jump to an MCR zone, could produce unexpected
and damaging results to your program and to machine
operation.
9.2 Jump Instruction
In PLC programming it is sometimes desirable to be able
to jump over certain program instructions when certain
conditions exist. The jump (JMP) instruction is an output
instruction used for this purpose. When the jump instruc-
tion is used, the PLC will not execute the instructions of a
rung that is jumped. The jump instruction is often used to
jump over instructions not pertinent to the machine’s op-
eration at that instant. In addition, sections of a program
may be programmed to be jumped should a production
fault occur.
Some manufacturers provide a skip instruction, which
is essentially the same as the jump instruction.
The program of Figure 9-6 illustrates the use of a
jump instruction in conjunction with Allen-Bradley
SLC 500 programmable controllers. Addresses Q2:0
through Q2:255 are the addresses used for the jump
(JMP) instructions. The label (LBL) instruction is a
target for the jump instruction. In addition, the jump
instruction with its associated label must have the same
address. The area of the program that the processor
jumps over is de ned by the locations of the jump and
label instructions in the program. If the jump coil is en-
ergized, all logic between the jump and label instruc-
tions is bypassed and the processor continues scanning
after the LBL instruction.
The operation of the program can be summarized as
follows:
• When the switch is open the jump instruction is not
activated.
• With the switch open, closing PB turns on all three
pilot lights.
• When the switch is closed the jump (JMP) instruc-
tion will activate.
• With the switch closed, pressing PB turns on pilot
lights PL1 and PL3 only.
• Rung 3 is skipped over during the PLC program
scan so PL2 is not turned on.
Figure9-7 illustrates the effect on input and output in-
structions of jumped rungs in a program. The label in-
struction is used to identify the ladder rung that is the
target destination but does not contribute to logic continu-
ity. For practical purposes the label instruction is always
considered to be logically true. The operation of the pro-
gram can be summarized as follows:
• When rung 4 has logic continuity, the processor is
instructed to jump to rung 8 and continue to execute
the main program from that point.
• Jumped rungs 5, 6, and 7 are not scanned by the
processor.
• Input conditions for the jumped rungs are not exam-
ined and outputs controlled by these rungs remain in
their last state.
• Any timers or counters programmed within the
jump area cease to function and will not update
themselves during this period. For this reason they
should be programmed outside the jumped section
in the main program zone.
You can jump to the same label from multiple jump
locations, as illustrated in the program of Figure9-8 . In
this example, there are two jump instructions addressed
Q2:20. There is a single label instruction addressed
Q2:20. The scan can then jump from either jump instruc-
tion to label Q2:20, depending on whether input A or
input D is true.
It is possible to jump backward in the program, but this
should not be done an excessive number of times. Care
must be taken that the scan does not remain in a loop too
long. The processor has a watchdog timer that sets the
maximum allowable time for a total program scan. If this
time is exceeded, the processor will indicate a fault and
shut down.
The forward jump is similar to an MCR instruction in
that both permit an input logic condition to skip over a
block of PLC ladder logic. The main difference between
Figure 9-6 Jump (JMP) operation.
LBL
Q2:0
JMP
Q2:0
PL3
PL3
PL2
PL1
PB
Switch
Switch
PL2
PB
PB
PL1
L2
L1
OutputsInputs
1
2
3
4
Ladder logic program
PB
pet10882_ch09_176-199.indd 180pet10882_ch09_176-199.indd 180 7/23/10 10:05 PM7/23/10 10:05 PM