Basic instructions
8.8 Program control operations
S7-1200 Programmable controller
304 System Manual, V4.2, 09/2016, A5E02486680-AK
SWITCH (Jump distributor)
Table 8- 133 SWITCH instruction
The SWITCH instruction acts as a program jump distributor to
control the execution of program sections. Depending on the re-
sult of comparisons between the value of the K input and the
values assigne
d to the specified comparison inputs, a jump occurs
to the program label that corresponds to the first comparison test
that is true. If none of the comparisons is true, then a jump to the
label assigned to ELSE occurs. Program execution continues with
the program instructions that follow the destination jump label.
For LAD and FBD: Click below the box name and select a data type from the drop-down menu.
2
For SCL: Use an IF-THEN set of comparisons.
Table 8- 134 Data types for parameters
Common comparison value input
==, <>, <, <=, >. >=
SInt, Int, DInt, USInt, UInt, UDInt, Real,
LReal, Byte, Word, DWord, Time,
Separate comparison value inputs for specific comparison
types
DEST0, DEST1, ..,
DESTn, ELSE
Program Labels Jump destination labels corresponding to specific compari-
sons:
The comparison input below and next to the K input is pro-
cessed first and causes a jump to the label assigned to
DEST0, if the comparison between the K value and this
input is true. The next comparison test uses the next input
below and causes a jump to the label assigned to DEST1, if
the comparison is true, The remaining comparisons are
processed similarly and if none of the comparisons are true,
then a jump to the label assigned to the ELSE output oc-
curs.
1
The K input and comparison inputs (==, <>, <, <=, >, >=) must be the same data type.