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.
1 : #var2 := 'A';
65..90: #var2 := 'UpperCase';
97..122: #var2 := 'LowerCase';
ELSE
#var2:= 'SpecialCharacter';
Table 7- 118 Elements of the FOR statement
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
Table 7- 119 Parameters
Required. An integer (Int or DInt) that serves as a loop counter
Required. Simple expression that specifies the initial value of the control variables
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.