Conditional Jump
If the content of the accumulator is TRUE, 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. The value in the accumulator must be of data type BOOL.
var_1 and var_2 can be of any data type since comparison is defined for any data type. var_3, var_4 and var_5 must be of numeric data types according to the operations performed with them. LABEL1 and LABEL2 must be valid labels within the program. The jump is only executed if the accu holds the value TRUE. Otherwise, program execution continues with the statement following the JMPC command.
A colon must follow the label itself, in the JMPC 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).
All input and output variables used for programming this function have been declared in the POU header.
(* Beginning of network 0 *) |
|||
LABEL0: |
LD |
var_1 |
(* Load var_1 in accu *) |
EQ |
var_2 |
(* Compare accu with var_2; store result of comparison in accu; result is of type BOOL*) |
|
JMPC |
LABEL1 |
(* If accu contains TRUE continue program execution at position 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*) |