Programming concepts
7.5 Programming language
S7-1200 Programmable controller
System Manual, V4.2, 09/2016, A5E02486680-AK
205
Calling other code blocks from your SCL program
To call another code block in your user program, simply enter the name (or absolute
address) of the FB or FC with the parameters. For an FB, you must provide the instance DB
to be called with the FB.
<DB name> (Parameter list)
Call as a single instance
<#Instance name> (Parameter list)
-instance
"MyDB"(MyInput:=10, MyInOut:="Tag1");
<FC name> (Parameter list)
<Operand>:=<FC name> (Parameter list)
"MyFC"(MyInput:=10, MyInOut:="Tag1");
You can also drag blocks from the navigation tree to the SCL program editor, and complete
the parameter assignment.
Adding block comments to SCL code
You can include a block comment in your SCL code by including the comment text between
(* and *). You can have any number of comment lines between the (* and the *). Your SCL
program block can include many block comments. For programming convenience, the SCL
editor includes a block comment button along with common control statements:
As with LAD and FBD, SCL allows you to use either tags (symbolic addressing) or absolute
addresses in your user program. SCL also allows you to use a variable as an array index.
dresses with the "%" symbol.
7 generates an undefined
tag error at compile time.
"Data_block_1".MyArray[#i]
Array element in a data block array