For internal use only / © Siemens AG 2012. All Rights Reserved.
TIA Portal V11 SP2
SCL in STEP 7 V11 SP2
For internal use only / © Siemens AG 2012. All Rights Reserved.
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Language description
Data Types
SCL in TIA Portal
Introduction
TIA Portal V11 SP2
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 3 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Language description
Data Types
SCL in TIA Portal
Introduction
SCL in STEP 7 V11 SP2What is SCL ?
S7-1200S7-400
WinACS7-300
Structured Control Language as text-basedCorresponds to IEC 61131-3 (ST) Certified according to PLCopenComplex calculations & algorithmsData operations, e.g. sort dataProgram code exchangeable between S7-1200, S7-300, S7-400 and WinAC
SCL := high-level language programming + extensions typical for PLCs ;
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 4 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Language description
Data Types
SCL in TIA Portal
Introduction
SCL in STEP 7 V11 SP2Usage of SCL: IF data_operation THEN SCL
3630.05290.0
6383.09215.0
13195.0
3630.05290.06383.09215.013195.0
Example: Storage of Real-values in an array
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 5 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Language description
Data Types
SCL in TIA Portal
Introduction
SCL in STEP 7 V11 SP2Usage of SCL: IF data_operation THEN SCL
S7-400
WinACS7-300
S7-1200
S7-400
WinACS7-300
S7-1200
Code in STL for S7-300/400
Code in LAD for S7-1200 Solution in SCL for S7-300/400
AND S7-1200 (with SP2)
For internal use only / © Siemens AG 2012. All Rights Reserved.
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Language description
Data Types
SCL in TIA Portal
Introduction
TIA Portal V11 SP2
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 7 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Language description
Data Types
SCL in TIA Portal
Introduction
SCL in STEP 7 V11 SP2Add a new block
Add a new block
Programming language
Block name
For internal use only / © Siemens AG 2012. All Rights Reserved.
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Language description
Data Types
SCL in TIA Portal
Introduction
TIA Portal V11 SP2
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 9 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Calling blocksControl operations
Indirect addressing
Direct addressingOperators
Language description
Data Types
SCL in TIA Portal
Introduction
SCL in STEP 7 V11 SP2Operators
(,)(Statement)Parenthesis
+,-+,-*, /, DIV, MOD**
Plus, minus (sign)Addition, SubtractionMultiplication, DivisionExponentiation
Arithmetic
<, <=, >, >=,=, <>
Less than, less than or equal to, greater than, greater than or equal to,equal, not equal to
Comparison
NOTAND, &ORXOR
NegationAND ORExclusive-OR
Binary logic
Assignment
Description
:=Assignment
OperatorCombination
result := expression ; Example: switch_on := manual_on OR auto_on;
All assignments, control operations and calls are ended by ;
S7-1200S7-400
WinACS7-300
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 10 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Calling blocksControl operations
Indirect addressing
Direct addressingOperators
Language description
Data Types
SCL in TIA Portal
Introduction
SCL in STEP 7 V11 SP2Control operations – Overview
Block abort
Loop aborts
Program loop(Abort possible)
Program branching
Exit program loopEXIT
Exit the blockRETURN
Program branching with BOOLean ValueIF
Program branching with INT ValueCASE
Program loop with run variableFOR
Program loop with execution conditionWHILE
Program loop with abort conditionREPEAT
Abort current loop passCONTINUE
Keyword Functionality
Control operations can be programmed easily using the code snippet!
S7-1200S7-400
WinACS7-300
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 11 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Calling blocksControl operations
Indirect addressing
Direct addressingOperators
Language description
Data Types
SCL in TIA Portal
Introduction
SCL in STEP 7 V11 SP2Program Branching - Syntax
IF Condition1 THEN
Statements 1;
ELSIF Condition 2 then
Statements 2;
ELSE
Statement s;
END_IF;
Condition is of type Bool
IF Statement:Example of use
STL
SCL
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 12 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Calling blocksControl operations
Indirect addressing
Direct addressingOperators
Language description
Data Types
SCL in TIA Portal
Introduction
SCL in STEP 7 V11 SP2Program Branching - Syntax
CASE Selection OF
Const1: Statements 1;
...
Constn: Statements n;
ELSE
Statements 3;
END_CASE;
Selection is of type INT
CASE Statement: Example of use
STL
SCL
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 13 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Calling blocksControl operations
Indirect addressing
Direct addressingOperators
Language description
Data Types
SCL in TIA Portal
Introduction
SCL in STEP 7 V11 SP2Program Branching - Syntax
For START_VAR TO END_VAR BY STEP_WIDTH DO
Statements;
END_FOR;
START_VAR, END_VAR und STEP_WIDTH must be of type INT or DINT
FOR Statement:
WHILE Condition DO
Statements;…..
END_WHILE;
Condition is of type BOOL
WHILE Statement: REPEAT Statement:
REPEAT
Statements;
UNTIL Condition;
END_REPEAT;
Condition is of type BOOL
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 14 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Calling blocksControl operations
Indirect addressing
Direct addressingOperators
Language description
Data Types
SCL in TIA Portal
Introduction
SCL in STEP 7 V11 SP2Program loop - Example
Example of useSTL SCL
With SCL:
Symbolic Programming possible
OR
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 15 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Calling blocksControl operations
Indirect addressing
Direct addressingOperators
Language description
Data Types
SCL in TIA Portal
Introduction
SCL in STEP 7 V11 SP2Loop abort - Syntax
For i:= a To c DO
IF condition THEN CONTINUE;
END_IF;
further Statements
END_FOR;
After Continue, the control variable is incremented by the specified increment immediately.
CONTINUE :
For i:= a To c DO
IF condition THEN EXIT;
END_IF;
END_FOR;
Execution of the program is continued after the end of the loop (FOR Loop).
EXIT :
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 16 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Calling blocksControl operations
Indirect addressing
Direct addressingOperators
Language description
Data Types
SCL in TIA Portal
Introduction
SCL in STEP 7 V11 SP2Block abort - Syntax
IF condition THEN Return;
ELSE statement1;
END_IF;
RETURN exits the currently active block (OB, FB, FC) and returns to the calling block
Return :
IF condition THEN GOTO LABEL;
END_IF ;
…..
LABEL: INDEX := 1 ;
GOTO causes an immediate jump to the specified label and therefore to a different statement within the same block.
GOTO :
For internal use only / © Siemens AG 2012. All Rights Reserved.
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Language description
Data Types
SCL in TIA Portal
Introduction
TIA Portal V11 SP2
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 18 2012-02-13 SCL in STEP 7 V11 SP2
Exercises
Source files
Compiling/testing
Further models for addressing
ExplicitImplicit
Type conversion
Language description
Data Types
SCL in TIA Portal
Introduction
Implicit data type conversion:Processing of operands of different data types
Automatic conversion of data types
Automatic conversion of data types to match the biggest one
No explicit conversion necessary
DInt
Int
SInt
LReal
S7-1200S7-400
WinACS7-300
Example:
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 19 2012-02-13 SCL in STEP 7 V11 SP2
Explicit data type conversion:Processing of operands of different data types (e.g. Char -> INT)
FBD (for S7 - 300 / S7-400)
SCL
SCL is also offering instructions for the explicit data type conversion (especially for String and Character types). With those instructions code keeps more independent of the used controller type.
For internal use only / © Siemens AG 2012. All Rights Reserved.
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Language description
Data Types
SCL in TIA Portal
Introduction
TIA Portal V11 SP2
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 21 2012-02-13 SCL in STEP 7 V11 SP2
SCL in STEP 7 V11 SP2Testing of SCL blocks
Einstellungen des Editors (S7-SCL V5.3)In case the loop is not executed:
Values have grey appearance
Monitor column can be adjusted in width and position
Collapsed: only result is shown
Expanded: all operands of a line are visible
Clicking a line shows an additional window with all referred operands
S7-1200S7-400
WinACS7-300
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 22 2012-02-13 SCL in STEP 7 V11 SP2
SCL in STEP 7 V11 SP2Block comparison
The comparison is performed directly in the SCL source code! Differences can be found easily!
Difference
List with all differences
Offline / Offline:
S7-1200
S7-400
WinACS7-300
Offline / Online:
S7-1200
For internal use only / © Siemens AG 2012. All Rights Reserved.
Exercises
Source files
Compiling/testing
Further models for addressing
Type conversion
Language description
Data Types
SCL in TIA Portal
Introduction
TIA Portal V11 SP2
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 24 2012-02-13 SCL in STEP 7 V11 SP2
Importing external source files
Import an external source file
S7-1200S7-400
WinACS7-300
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 25 2012-02-13 SCL in STEP 7 V11 SP2
Importing external source files
Generate blocks
Source files from STEP 7 classic can be easily imported and generated in STEP 7 V11!
S7-1200S7-400
WinACS7-300
For internal use only / © Siemens AG 2012. All Rights Reserved.I IA AS S SUP FAPage 26 2012-02-13 SCL in STEP 7 V11 SP2
Saving blocks as external source files
11
Blocks can be saved easily as external source files
22
S7-1200S7-400
WinACS7-300
For internal use only / © Siemens AG 2012. All Rights Reserved.
I IA AS S SUP FA
Gleiwitzerstr.55590475 Nürnberg
Phone: +49 (911) 895 - 4646
E-Mail: [email protected]
Thank you for your attention!
Top Related