EasyManua.ls Logo

Siemens S7-1200 - CASE Statement

Siemens S7-1200
1028 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Basic instructions
7.8 Program control operations
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
269
7.8.9.3
CASE statement
Table 7- 116 Elements of the CASE statement
SCL
Description
CASE "Test_Value" OF
"ValueList": Statement[; Statement, ...]
"ValueList": Statement[; Statement, ...]
[ELSE
Else-statement[; Else-statement, ...]]
END_CASE;
The CASE statement executes one of several
groups of statements, depending on the value
of an expression.
Table 7- 117 Parameters
Parameter
Description
"Test_Value"
Required. Any numeric expression of data type Int
"ValueList" Required. A single value or a comma-separated list of values or ranges of values. (Use two
periods to define a range of values: 2..8) The following example illustrates the different
variants of the value list:
1: Statement_A;
2, 4: Statement _B;
3, 5..7,9: Statement _C;
Statement Required. One or more statements that are executed when "Test_Value" matches any value
in the value list
Else-statement Optional. One or more statements that are executed if no match with a value of the
"ValueList" stated matches
The CASE statement is executed according to the following rules:
The Test_value expression must return a value of the type Int.
When a CASE statement is processed, the program checks whether the value of the
Test_value expression is contained within a specified list of values. If a match is found,
the statement component assigned to the list is executed.
If no match is found, the program section following ELSE is executed or no statement is
executed if the ELSE branch does not exist.

Table of Contents

Other manuals for Siemens S7-1200

Related product manuals