Programming instructions

95
13.18 Program Flow Control
By default the PLC program processes top to bottom and left to right. At the
beginning of the program, the actual inputs on the system are read into an image
memory. The program is then processed, with modifications being made to the
internal image memory. Once the END instruction is reached, the outputs are
updated based on the image memory. Then the process begins again.
Sometimes this program flow needs to be controlled. There are several options
for controlling the flow of the program. These methods include jumps and
subroutine calls.
These commands use the pointer addresses mentioned earlier. To set a pointer,
double click in the left margin of the ladder before the power rail and enter an
address beginning with P. This is the pointer. When referencing this location in
a jump or subroutine, call it by its Pxx address.
NOTE: Address P63 is reserved. It is a jump to the END instruction. Do NOT
code a P63 in your program, or an error will be generated.
CJ – Conditional Jump
The conditional jump command allows a section of logic to be skipped. The
command is activated when the conditions leading up to the CJ instruction are
true. When the jump is executed, all code between the CJ command and the
pointer is not executed.