Jumps   JMP   JMPC   JMPNC   JMPCN

Statement - Jump to a label.

Remarks

A jump to a label branches the execution of the program after the specified label. Labels and jumps cannot be used in structured ST language. In FBD language, a jump is represented by the ">>" symbol followed by the label name. The input of the ">>" symbol must be connected to a valid boolean signal. The jump is performed only if the input is TRUE. In LD language, the ">>" symbol, followed by the target label name, is used as a coil at the end of a rung. The jump is performed only if the rung state is TRUE.  In IL language, JMP, JMPC, JMPCN and JMPNC instructions are used to specify a jump. The destination label is the operand of the jump instruction.

Warning: backward jumps may lead to infinite loops that block the target cycle.

ST Language

Not available

FBD Language

(* In this example the TON block will not be called if bEnable is TRUE *)
JumpFbd.gif (1708 octets)

LD Language

(* In this example the second rung will be skipped if IN1 is TRUE *)
JumpLd.gif (1971 octets)

IL Language:

Below is the meaning of possible jump instructions:
JMP    Jump always
JMPC   Jump if the current result is TRUE
JMPNC  Jump if the current result is FALSE
JMPCN  Same as JMPNC

Start:   LD   IN1
         JMPC TheRest (* Jump to "TheRest" if IN1 is TRUE *)

         LD   IN2     (* these three instructions are not executed *)
         ST   Q2      (* if IN1 is TRUE *)
         JMP  TheEnd  (* unconditional jump to "TheEnd" *)

TheRest: LD   IN3
         ST   Q3
TheEnd:

See also

Labels   RETURN