0% found this document useful (0 votes)
188 views17 pages

InfoPLC Net S17-SCL

This document provides an overview and introduction to Structured Control Language (SCL) in TIA Portal with Siemens S7-1200/1500 PLCs. It discusses the SCL editor, creating simple SCL blocks, debugging SCL code, data types, program control structures, and math/string/array operations. The presentation includes live demos of embedding SCL in ladder logic and using SCL for array processing.

Uploaded by

pere
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
188 views17 pages

InfoPLC Net S17-SCL

This document provides an overview and introduction to Structured Control Language (SCL) in TIA Portal with Siemens S7-1200/1500 PLCs. It discusses the SCL editor, creating simple SCL blocks, debugging SCL code, data types, program control structures, and math/string/array operations. The presentation includes live demos of embedding SCL in ladder logic and using SCL for array processing.

Uploaded by

pere
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 17

10/2/2019

Siemens
Intro to Structured Control Language (SCL)
in TIA Portal with S7-1200/1500

Kelly Anton | 10-24-2019

Agenda

• Brief Overview of SCL


• SCL Editor
• Create simple SCL block
• Debugging SCL
• Data types
• Program Control
• Math, Strings and Arrays
• Live Demos

1
10/2/2019

SCL (Structured Control Language) - Defined

• High-level programming language based on PASCAL


• Text based language

SCL – Common Uses

• Math
• String Operations
• Array Operations
• Communication
• Program Flow

2
10/2/2019

SCL – Options > Settings (Editor Settings)


• General > Script/text editors Font size

• PLC programming > SCL (Structured Control Language)

SCL – FC/FB Blocks

• Add New SCL FC/FB Block

3
10/2/2019

SCL – FC/FB Block Parameters

• Create parameters in interface area just like LAD


• Step 7 5.x parameters
in code. Easier in TIA.

SCL – FC/FB Block Parameters New Option with V15.1


• Interface area setting for Table view or Textual view
• Options > Settings > PLC Programming > SCL > Interface

4
10/2/2019

SCL - Calling FC’s and FB’s

• Call FC/FB from LAD

• Call FC from SCL

• Call FB from SCL

SCL – SCL Network Embedded in Ladder (LAD)

• Insert SCL Network in LAD…

10

5
10/2/2019

SCL – General Rules

• Instructions can span several lines


• Each instruction ends with a semicolon ;
• Not case sensitive

11

SCL – Comments

• Document your code


• Comments do not affect program execution

12

6
10/2/2019

SCL – Regions

• Used for readability of code

13

SCL – Built-in functions

• Ctrl + Space brings up a list of functions & tags


• Use Instructions tab and drag into code
• Start typing … to use intellisense

14

7
10/2/2019

SCL – Surround with

• Quickly wrap selected lines of code with statement

15

SCL – Debugging Syntax Errors

• Missing ; at end of statement


• Used = instead of := for assignment
• Start with first error because it could be causing other errors

16

8
10/2/2019

SCL – Debugging Logic Errors

• Syntactically correct, but logic is incorrect


• Monitor all logic or monitor from selected line on
• Use Watch Tables

17

SCL – Debugging Logic with Breakpoints

• As of V15 the following CPU’s support breakpoints


– S7300/400 and S7-1500 (firmware 2.5 or later)
• Single step
• Run to cursor

• Breakpoint
not allowed.

18

9
10/2/2019

SCL – Data types and conversion

• Implicit conversion will take place or use CONVERT

19

SCL – Typed and non-typed constants

• Implicit conversion will take place


• It is best to type the constants, eliminates yellow warnings
– INT#, DINT#, REAL# etc.

20

10
10/2/2019

SCL – Result data Type of Arithmetic functions


• Two fixed-point numbers with sign, result receives larger type
– INT + DINT = DINT

• Two fixed-point numbers without sign, result receives larger type


– USINT + UDINT = UDINT

• One fixed-point number with sign and the other does not, result receives next larger type with
sign
– SINT + USINT = INT

• One fixed-point number and floating point, result receives floating point type
– INT + REAL = REAL

• Two floating-point types, result receives larger floating point type


– REAL + LREAL = LREAL

21

SCL – Arithmetic, Logical and Relational expressions

22

11
10/2/2019

SCL – Program Control with If … Then …

• Basic Instructions – Drag into SCL code

23

SCL – Program Control with CASE … OF …

24

12
10/2/2019

SCL – Program Control with For, While and Repeat loops

Tip: Enable Monitor Loops

25

SCL – Program Control with For, While and Repeat loops

26

13
10/2/2019

SCL – Program Control with For, While and Repeat loops

• CONTINUE
– Finishes current execution of FOR, WHILE, or REPEAT loop
– Skips remaining lines and jumps to loop check condition
• EXIT
– Leaves a FOR, WHILE, or REPEAT at any point in loop
– Skips remaining lines while exiting loop

27

SCL – Math compared to CALCULATE LAD Block

• CALCULATE block uses INx parameters in expressions


• SCL expression uses actual tag names including constants
• SCL easier to read

28

14
10/2/2019

SCL – String processing

29

SCL – Array Processing

• Array defined in DB

30

15
10/2/2019

SCL – Editing Tips with Smart Editor


• SCL Editor is more than a simple text editor, watch for colors

31

Live Demos

• Embed SCL in LAD Block


• Create SCL Block
• Array Processing
• Breakpoints

32

16
10/2/2019

SCL - Resources
• Structured Control Language (SCL V4, V5.0) for S7-300/S7-400 Programming

https://support.industry.siemens.com/cs/us/en/view/1137188

• S7-SCL V5.3 for S7-300/400 Getting Started

https://support.industry.siemens.com/cs/us/en/view/18735131

• STEP 7 Basic/Professional V15.1 and SIMATIC WinCC V15.1 System Manual

https://support.industry.siemens.com/cs/us/en/view/109755202

• Berger Book- Automating with SIMATIC S7-1500

SCL Chapter

33

17

You might also like