Unconditional Jump
The program execution is continued at the label defined in the operand field.
Valid operands for this operator must be of one of the following data types: Any existing label in the program is valid.
var_1, var_2, var_3, var_4 and var_5 must be of numeric data types in this example. LABEL1 and LABEL2 must be valid labels within the program. A colon must follow the label itself, in the JMP statement, however, the colon after the label name has to be omitted.
Labels can only be inserted at the beginning of a network. A label can be inserted at the beginning of any network, even if it is not jumped to (e.g. LABEL0 in this code sample fragment).
In the POU header, all input and output variables are declared that are used for programming this function.
(* Beginning of network 0 *) |
|||
LABEL0: |
LD |
var_1 |
(* Load var_1 in accu *) |
ADD |
var_2 |
(* Add var_2 to accu; result is stored in accu *) |
|
JMP |
LABEL1 |
(* Continue program execution at position marked by LABEL1 *) |
|
(* Beginning of network 1 *) |
|||
LABEL1: |
MUL |
var_3 |
(* Multiply accu by var_3 *) |
SUB |
var_4 |
(* Subtract var_4 from accu; result is store in accu *) |
|
ST |
var_5 |
(* Store accu in var_5 *) |
|
JMP |
LABEL2 |
(* Continue program execution at position marked by LABEL2 *) |
|
LABEL2: |