Technical data

Creating Blocks and Libraries
9.2 Selecting the Programming Language
Programming with STEP 7
Manual, 05/2010, A5E02789666-01 221
9.2.4 S7 SCL Programming Language
The programming language SCL (Structured Control Language) is available as an optional
package. This is a high-level text-based language whose global language definition conforms to
IEC 1131-3. The language closely resembles PASCAL and, other than in STL, simplifies the
programming of loops and conditional branches due to its high-level language commands, for
example. SCL is therefore suitable for calculating equations, complex optimization algorithms, or
the management of large data volume.
S7 SCL programs are written in the source code editor.
Example:
FUNCTION_BLOCK FB20
VAR_INPUT
ENDVAL: INT;
END_VAR
VAR_IN_OUT
IQ1 : REAL;
END_VAR
VAR
INDEX: INT;
END_VAR
BEGIN
CONTROL:=FALSE;
FOR INDEX:= 1 TO ENDVALUE DO
IQ1:= IQ1 * 2;
IF IQ1 >10000 THEN
CONTROL = TRUE
END_IF
END_FOR;
END_FUNCTION_BLOCK