SCL Programming TIA Portal
SCL Programming TIA Portal
MU Department of Education
Illa dels Banyols Institute
SCL is a structured text language whose syntax is similar to other high-level, general-purpose languages such as
Pascal or C.
1. The first thing to do is to create a table with the input and output variables that will be used in the
programming.
Segment 1
Comment
%FC1
"REE_SCL"
IN EMO
Version: 1.0
Elaborated by: Enrique Ubeda
Printing date: 02/12/2019
ILLA deis Archive: SCL_Programming.doc Page1 6
(Generalitat of Catalonia
MU Department of Education
Illa dels Banyols Institute
4. SCL code must be written in the FC block.
SCL code:
"Output0":=0;
7 _END_IF;
SCL code:
9 //SCL Examples (C) REEA 2013
10 //Activate an output (Set)
11 E1IF "Input"=true THEN
12 "Output":=true;
13 _END_IF;
14 //Disable an output (Reset)
15 IF "Input2"=true THEN
16 "Salidal":=false;
17 END_IF;
Segment 2:
■500.1
to ida
Version: 1.0
Elaborated by: Enrique Ubeda
Printing date: 02/12/2019
Archive: SCL_Programming.doc Page2 6
(Generalitat of Catalonia
MU Department of Education
Illa dels Banyols Institute
Example 3: Series association (AND) of two input variables.
SCL code:
SCL code:
Version: 1.0
Elaborated by: Enrique Ubeda
Printing date: 02/12/2019
ILLA deis Archive: SCL_Programming.doc Page3 6
(Generalitat of Catalonia
MU Department of Education
Illa dels Banyols Institute
Previously, some examples of SCL code using the IF- THEN conditional were shown. While its use is suitable
for controlling the value of variables in many programming applications that must be met by establishing logical
conditions, it is not the only way to do so. The following shows how to perform similar operations in S7-1200
programming without resorting to the use of IF-THEN.
The examples show the SCL code and the LAD program of the equivalent "electrical" circuit.
SCL code:
The value of the output is equal to the logical value of the input.
Equivalent in KOP:
#0.0 #0.0
'■■■■!.' 5nlidno"
SCL code:
The output is only activated if the AND condition is met on the inputs.
Equivalent in KOP:
Version: 1.0
Elaborated by: Enrique Ubeda
Printing date: 02/12/2019
ILLA deis Archive: SCL_Programming.doc Page4 6
(Generalitat of Catalonia
MU Department of Education
Illa dels Banyols Institute
SCL code:
The output is activated by two inputs connected in parallel (OR) //SCL Examples (C) REEA 2013 //Inputs in parallel
"Output2":= ”Input3” OR "Input4";
Equivalent in KOP:
"40 2 Sd Idtp'
SCL code:
The value of the output is the opposite of the input. //SCL Examples (C) REEA 2013
//Deny the value of a variable (closed contact) "Output3" := NOT ”Input5”;
Equivalent in KOP:
*0.3 0.5
"Input3" "Output5"
--------1 |--------------1 NOT |--------------------------------------------------( }-------।
SCL code:
Input 4 functions as a start button. Input 7 as a stop button. Thus, when Input 4 is activated, the output is set to
1 and is maintained by the feedback contact connected in parallel with said input. If in this situation, Input 7
is activated, the output value is 0 and therefore it stops providing feedback.
Version:
Elaborated by:
Printing date:
Archive:
1.0
Enrique Ubeda
02/12/2019
SCL_Programming.doc Page5 6
(Generalitat of Catalonia
MU Department of Education
Illa dels Banyols Institute
Equivalent in KOP:
• Entry0 Boolean WO
The program in SCL has been written in an FC, which is called unconditionally from OB1 or main block.
Version:
Elaborated by:
Printing date: 1.0
Enrique Ubeda
02/12/2019
SCL_Programming.doc Page6 6
(Generalitat of Catalonia
MU Department of Education
Illa dels Banyols Institute
Archive:
1.0
Enrique Ubeda
02/12/2019
SCL_Programming.doc Page7 6