KEMBAR78
Programming Theory EN | PDF | Programmable Logic Controller | Parameter (Computer Programming)
0% found this document useful (0 votes)
10 views28 pages

Programming Theory EN

Programming Interface in TIA Portal

Uploaded by

Aurelio Aleixo
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)
10 views28 pages

Programming Theory EN

Programming Interface in TIA Portal

Uploaded by

Aurelio Aleixo
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/ 28

S7-1200

Basic Controller
Learning Path
3) Programming
Agenda

1 PLC Concepts Overview

2 Data Storage and Memory Areas

3 Programming Interface in TIA Portal

4 Programming Languages

5 Testing & Debugging Programs

6 Get more Information

Page 2 Unrestricted | © Siemens 2021 – 2022


S7-1200 Basic Controller
PLC Concepts Overview

Basic Learning Path


Organization blocks (OB) define structure of
program and responds to CPU events, e.g.
Automation Program Structure (1) • OB100: upon CPU startup
• OB1: main OB that runs cyclically

Automation program Function blocks (FB) are subroutines


and can have multiple instances, each
using their own instance data block (DB)

FB
Instance
DB

HW FW OB Global
Hardware Firmware MAIN DB

FC

Data blocks (DB)


store data used by
program blocks
Functions (FC) are subroutines not
associated with any data block (DB)

Page 4 Unrestricted | © Siemens 2021 – 2022


Automation Program Structure (2)
The same FB can be used to control several similar
machines, with each instance DB storing the data for
each individual machine
Automation program

controls
FB 1 Machine 1
Instance
DB 1

OB controls
MAIN FB 1 Machine 2
Instance
DB 2

controls
FB 1 Machine 3
Instance
DB 3

Page 5 Unrestricted | © Siemens 2021 – 2022


Programming Guidelines Optimal, consistent and safety programming
support.industry.siemens.com/cs/document
/90885040

Provides recommendations and notes on


optimal programming of S7-1200/1500
controllers:

✓ uniform programming
✓ complete set of commands for every
language
✓ fully symbolic program generation
✓ data handling also without pointer
✓ reusability of created blocks

Page 6 Unrestricted | © Siemens 2021 – 2022


S7-1200 Basic Controller
Data Storage and Memory Areas

Basic Learning Path


Data Storage and Memory Areas

CPU global memory PLC tag tables Data blocks (DB)


• Inputs (I) Allows global symbolic name addressing for Stores data for code blocks
• Outputs (Q) specific memory locations for • Global DB for all code blocks
• Bit memory (M), e.g. system & clock • Inputs, outputs and bit memory • Instance DB for specific FB
memory • User constants (cannot be changed)

Temp memory A tag stores data/value and is described by:


• name
Temporary data (L - local) that only lasts • memory area
during execution of code block • address
PLC tags can also be organized into tag
tables for clarity • data type

Page 8 Unrestricted | © Siemens 2021 – 2022


S7-1200 Basic Controller
Programming Interface in TIA Portal

Basic Learning Path


Programming Interface in TIA Portal

Project Tree Task Cards (tools)

Working area

Program Blocks

Safety Program
Blocks

PLC Tag Tables

Inspector window

Page 10 Unrestricted | © Siemens 2021 – 2022


PLC Tag Table in TIA Portal 3) Retain value of tag even when CPU
is switched off or offline
2) Specify name, data type and I/O
address of PLC tags

1) Open PLC tag tables

Tag tables provide clarity when


organizing PLC tags 4) Specify access to HMI, OPC UA and/or
Web API (enabled by default)
Page 11 Unrestricted | © Siemens 2021 – 2022
Adding a New Block in TIA Portal

3) Name the block

2) Select type of block 4) Specify programming


(OB, FB, FC, DB) language for FB and FC

1) Add new block

Page 12 Unrestricted | © Siemens 2021 – 2022


Data Blocks (DB) in TIA Portal

2) Specify name, data type and 3) Retain value of tag even when CPU
start value of DB tags is switched off or offline

4) Specify access to HMI, OPC UA and/or


Web API (enabled by default)

1) Open DB under Program


Blocks

Page 13 Unrestricted | © Siemens 2021 – 2022


Functions (FC) and Function Blocks (FB) in TIA Portal 1) Specify the variables in the block interface:
Function inputs
Function outputs
In-outs
Temporary variables
Constants

Block
Interface InOut: Input variables that are also outputs of the block

Temp: Local temporary variables, lasts within block call

Program
Editor

2) Design the automation program

Page 14 Unrestricted | © Siemens 2021 – 2022


Functions (FC) and Function Blocks (FB) in TIA Portal

1. Variable: Declared by an identifier and


allocate memory at a specific address (e.g.
PLC tag, user constant, DB tags)
2. Current value: The actual value of the
parameter
2 3. Actual parameter: Variables connected to
3 the formal parameters of a block
4
4. Formal parameter: Variables which are
1 declared in the interface of a block, for use
within a program

Page 15 Unrestricted | © Siemens 2021 – 2022


S7-1200 Basic Controller
Programming Languages

Basic Learning Path


Supported Programming Languages in S7-1200 Controllers

Ladder Logic (LAD) Function Block Diagram (FBD) Structured Control Language (SCL)

Representation Electrical circuit ladder with Graphical function blocks and PASCAL-based programming
horizontal rungs connecting two logic symbols used in Boolean language, generally more compact
vertical power rails algebra

Useful for Programs with relay logic and bit Programs with more Large programs with complex
operations that electricians are mathematical and other complex instructions, such as loops and
familiar with: functions switch conditions

• normally closed (NC) contacts Writing library functions for


• normally open (NO) contacts external use
• coils

Page 17 Unrestricted | © Siemens 2021 – 2022


Inserting New Network in Other Languages

LAD/FBD network

SCL network

1) Right click anywhere on


current network

2) Click “Insert SCL network”

Page 18 Unrestricted | © Siemens 2021 – 2022


Useful Libraries in TIA Portal

Application examples for instructions Additional common functions for automation


support.industry.siemens.com/cs/document support.industry.siemens.com/cs/document
/109476781 /109479728

This library can be used unrestricted and


Use the program examples to gain a better
contains features such as FIFO, search
understanding of the functionality of the
function, matrix calculations, astro timer etc.:
instructions in TIA Portal or to save work effort
✓ immediately usable by parameterization
✓ programming support on how to use
✓ can be used universally
instructions
✓ not protected and therefore customizable
✓ can be easily tested without any significant
✓ best documented including interface
extra effort
description

Page 19 Unrestricted | © Siemens 2021 – 2022


Optimal, Consistent and Safe Programming

Programming Styleguide TIA Portal Test Suite Advanced


support.industry.siemens.com/cs/document support.industry.siemens.com/cs/document
/109478084 /109779806

Create an automation program that supports:

✓ consistent continuous style


✓ easily readable and comprehensible
✓ simple maintenance and reusability
✓ easy and quick troubleshooting and error correction
✓ efficient working at the same project with several programmers

Page 20 Unrestricted | © Siemens 2021 – 2022


S7-1200 Basic Controller
Testing & Debugging Programs

Basic Learning Path


Enable Simulation Support for PLCSIM

3) Click on Protection settings

1) Right click on
Project

4) Enable checkbox

2) Click on Properties

Page 22 Unrestricted | © Siemens 2021 – 2022


Downloading User Program
2) Click on Download button

1) Click on PLC

4) Click
3) Key in“Start module”(if
password and click on
protection
Finish button
enabled) and click on Load button

Page 23 Unrestricted | © Siemens 2021 – 2022


Watch Tables

3) Click “Go online”

4) Click on “Monitor variables” icon

1) Add new watch table 2) Insert PLC tags required to be monitored


under “Watch and
force tables”
The watch table is used to monitor or modify PLC tags.

Page 24 Unrestricted | © Siemens 2021 – 2022


Force Tables

4) Click “Go online”

5) Click on “Enable forcing” icon

2) Insert PLC tags required for 3) Select the tags to


value forcing activate forcing

1) Go to Force table
under “Watch and The force table is used to overwrite tags with any desired values independent
force tables” of the user program logic.
A force task can only be canceled by deactivating the Force button

Page 25 Unrestricted | © Siemens 2021 – 2022


S7-1200 Basic Controller
Get more Information

Basic Learning Path


SIMATIC Controllers
Get more Information …

Programming Styleguide TIA Portal Tutorial Center

Optimal, consistent and safety programming Work effectively with TIA Portal!
Create an optimal program regarding technical Gain an overview of functions and tools in the TIA
possibilities and consistency Portal via detailed tutorial videos

https://support.industry.siemens.com/cs/ww/ https://support.industry.siemens.com/cs/d
en/view/81318674 ocument/106656707/the-tia-portal-tutorial-
center-(videos)

Library of General Functions Protection & Security

Additional common functions for automation Detailed information on security and protection
This library can be used unrestricted and contains features
features such as FIFO, search function, matrix Learn about read, write and know-how protection of
calculations, astro timer etc. controllers and programming blocks.

https://support.industry.siemens.com/ https://support.industry.siemens.com/
cs/document/109479728/ cs/document/90885010/

Page 27 Unrestricted | © Siemens 2021 – 2022


SIMATIC Controllers
Get more Information …

SIMATIC S7-1200 Entry in SIMATIC S7-1200

Overview Topic page


SIMATIC S7-1200 Controllers are the intelligent Important links to SIMATIC S7-1200.
choice for compact automation solutions with
integrated communication and technology functions.

https://siemens.com/S7-1200 https://support.industry.siemens.com/cs/
document/35923253

Programming basics

Course
SIMATIC - Basics for Programming Programmable
Logic Controllers (PLC)

https://siemens-learning-
sitrainaccess.sabacloud.com/Saba/Web_spf
/EU2PRD0112/guestapp/ledetail/cours0000
00000007885

Page 28 Unrestricted | © Siemens 2021 – 2022

You might also like