EasyManua.ls Logo

Siemens SIMATIC S7-1200 - Page 205

Siemens SIMATIC S7-1200
1614 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...
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)
Call as multi
-instance
"MyDB"(MyInput:=10, MyInOut:="Tag1");
<FC name> (Parameter list)
Standard call
<Operand>:=<FC name> (Parameter list)
Call in an expression
"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:
Addressing
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.
Absolute addressing
%I0.0
Precede absolute ad
dresses with the "%" symbol.
Without the "%", STEP
7 generates an undefined
tag error at compile time.
%MB100
Symbolic addressing
"PLC_Tag_1"
Tag in PLC tag table
"Data_block_1".Tag_1
Tag in a data block
"Data_block_1".MyArray[#i]
Array element in a data block array

Table of Contents

Other manuals for Siemens SIMATIC S7-1200

Related product manuals