SWITCH: Jump distributor (S7-1200, S7-1500) - STEP 7

FBD (S7-1200, S7-1500)

ft:publication_title
FBD (S7-1200, S7-1500)
Product
STEP 7
Version
V20
Publication date
11/2024
Language
en-US
SWITCH: Jump distributor

Description

You can use the "Jump distributor" instruction to define multiple program jumps to be executed depending on the result of one or more comparison instructions.

You specify the value to be compared in the K parameter. This value is compared with the values that are provided by the various inputs. You can select the comparison method for each individual input. The availability of the various comparison instructions depends on the data type of the instruction.

The following table shows the comparison instructions that are available depending on the selected data type:

Data type

Instruction

Syntax

S7-1200

S7-1500

Bit strings

Bit strings

Equal

==

Not equal

<>

Integers, floating-point numbers, TIME, DATE, TOD

Integers, floating-point numbers, TIME, LTIME, DATE, TOD, LTOD, LDT

Equal

==

Not equal

<>

Greater or equal

>=

Less or equal

<=

Greater than

>

Less than

<

You can select the data type of the instruction from the "???" drop-down list of the instruction box. If you select a comparison instruction and the data type of the instruction is not yet defined, then the "???" drop-down list will only list those data types that are permitted for the selected comparison instruction.

Execution of the instruction begins with the first comparison and runs until a comparison condition is met. If a comparison condition is met, the subsequent comparison conditions are not considered. If none of the specified comparison conditions are fulfilled, the jump is executed at output ELSE. If not jump label is defined at output ELSE, the linear execution of the program is not interrupted but instead continued in the next network.

In its initial state the instruction box contains at least 2 outputs (DEST0 and DEST1). The number of outputs can be extended. The numbering of the outputs begins with the value "0" and is continued in ascending order with each new output. Specify jump labels (LABEL) at the outputs of the instruction. Instructions or operands cannot be specified at the outputs of the instruction.

An input is automatically inserted to each additional output. The jump programmed at an output is executed if the comparison condition of the corresponding input is fulfilled.

Parameters

The following table shows the parameters of the instruction "Jump distributor":

Parameters

Declaration

Data type

Memory area

Description

S7-1200

S7-1500

EN

Input

BOOL

BOOL

I, Q, M, D, L or constant

Enable input

K

Input

UINT

UINT

I, Q, M, D, L or constant

Specifies the value to be compared.

<Comparison values>

Input

Bit strings, integers, floating-point numbers, TIME, DATE, TOD

Bit strings, integers, floating-point numbers, TIME, LTIME, DATE, TOD, LTOD, LDT

I, Q, M, D, L or constant

Input values with which the value of the parameter K is compared.

DEST0

-

-

-

-

First jump label

DEST1

-

-

-

-

Second jump label

DEST(n)

-

-

-

-

Optional jump labels:

  • S7-1200: n = 2 to 32

  • S7-1500: n = 2 to 256

ELSE

-

-

-

-

Program jump which is executed if none of the comparison conditions are fulfilled.

For additional information on valid data types, refer to "See also".

Example

The following example shows how the instruction works:

The following table shows how the instruction works using specific operand values:

Parameters

Operand/jump label

Value

K

Tag_Value

23

==

Tag_Value_1

20

>

Tag_Value_2

21

<

Tag_Value_3

19

DEST0

LABEL0

Jump to jump label "LABEL0", if the value of parameter K is equal to 20.

DEST1

LABEL1

Jump to jump label "LABEL1", if the value of parameter K is greater than 21.

DEST2

LABEL2

Jump to jump label "LABEL2", if the value of parameter K is less than 19.

ELSE

LABEL3

Jump to jump label "LABEL3", if the none of the comparison conditions are fulfilled.

If the operand "Tag_Input" changes to signal state "1", the instruction is executed. The execution of the program is continued in the network that is identified with the jump label "LABEL1".