EasyManua.ls Logo

Siemens S7-1200 - FOR 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
270 System Manual, 03/2014, A5E02486680-AG
CASE statements can be nested. Each nested case statement must have an associated
END_CASE statement.
CASE "var1" OF
1 : #var2 := 'A';
2 : #var2 := 'B';
ELSE
CASE "var3" OF
65..90: #var2 := 'UpperCase';
97..122: #var2 := 'LowerCase';
ELSE
#var2:= 'SpecialCharacter';
END_CASE;
END_CASE;
7.8.9.4
FOR statement
Table 7- 118 Elements of the FOR statement
SCL
Description
FOR "control_variable" := "begin" TO "end"
[BY "increment"] DO
statement;
;
END_FOR;
A FOR statement is used to repeat a sequence of
statements as long as a control variable is within
the specified range of values. The definition of a
loop with FOR includes the specification of an
initial and an end value. Both values must be the
same type as the control variable.
You can nest FOR loops. The END_FOR
statement refers to the last executed FOR
instruction.
Table 7- 119 Parameters
Parameter
Description
"control_variable"
Required. An integer (Int or DInt) that serves as a loop counter
"begin"
Required. Simple expression that specifies the initial value of the control variables
"end"
Required. Simple expression that determines the final value of the control variables
"increment" Optional. Amount by which a "control variable" is changed after each loop. The "increment"
has the same data type as "control variable". If the "increment" value is not specified, then
the value of the run tags will be increased by 1 after each loop. You cannot change
"increment" during the execution of the FOR statement.

Table of Contents

Other manuals for Siemens S7-1200

Related product manuals