300 inside TIA Portal: Configuring, Programming and Testing with STEP 7 Pro
omating-with-simatic-s7-300-inside-tia-portal-configuring-programming-and-tes
This Book is Available on YakiBooki.com
300 inside TIA Portal: Configuring, Programming and Testing with STEP 7 Pro
omating-with-simatic-s7-300-inside-tia-portal-configuring-programming-and-tes
Berger Automating with SIMATIC S7-300 inside TIA Portal
This Book is Available on YakiBooki.com
300 inside TIA Portal: Configuring, Programming and Testing with STEP 7 Pro
omating-with-simatic-s7-300-inside-tia-portal-configuring-programming-and-tes
This Book is Available on YakiBooki.com
300 inside TIA Portal: Configuring, Programming and Testing with STEP 7 Pro
omating-with-simatic-s7-300-inside-tia-portal-configuring-programming-and-tes
Automating with
SIMATIC S7-300
inside TIA Portal
Configuring, Programming and Testing
with STEP 7 Professional
by Hans Berger
2nd edition, 2014
Publicis Publishing
This Book is Available on YakiBooki.com
300 inside TIA Portal: Configuring, Programming and Testing with STEP 7 Pro
The Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie;
detailed bibliographic data are available on the Internet at http://dnb.d-nb.de.
omating-with-simatic-s7-300-inside-tia-portal-configuring-programming-and-tes
The author, translators, and publisher have taken great care with all texts and
illustrations in this book. Nevertheless, errors can never be completely avoided.
The author, translators, and publisher accept no liability, for whatever legal reasons,
for any damage resulting from the use of the programming examples.
www.publicis-books.de
Print ISBN 978-3-89578-443-9
ePDF ISBN 978-3-89578-924-3
2nd edition, 2014
Editor: Siemens Aktiengesellschaft, Berlin and Munich
Publisher: Publicis Publishing, Erlangen
© 2014 by Publicis Erlangen, Zweigniederlassung der PWW GmbH
The publication and all parts thereof are protected by copyright.
Any use of it outside the strict provisions of the copyright law without
the consent of the publisher is forbidden and will incur penalties. This applies
particularly to reproduction, translation, microfilming,
or other processing, and to storage or processing in
electronic systems. It also applies to the use of individual figures
and extracts from the text.
Printed in Germany
This Book is Available on YakiBooki.com
Preface
300 inside TIA Portal: Configuring, Programming and Testing with STEP 7 Pro
Preface
omating-with-simatic-s7-300-inside-tia-portal-configuring-programming-and-tes
The SIMATIC automation system unites all of the subsystems of an automation
solution under a uniform system architecture to form a homogenous whole from
the field level right up to process control.
The Totally Integrated Automation (TIA) concept permits uniform handling of all au-
tomation components using a single system platform and tools with uniform oper-
ator interfaces. These requirements are fulfilled by the SIMATIC automation sys-
tem, which provides uniformity for configuration, programming, data manage-
ment, and communication.
This book describes the hardware components of the SIMATIC S7-300 automation
system with standard controllers and the features provided for designing a distrib-
uted control concept with PROFIBUS and PROFINET. To permit communication with
other automation systems, the controllers offer integrated bus interfaces for multi-
point interface (MPI), PROFIBUS, and Industrial Ethernet.
The STEP 7 Professional engineering software inside TIA Portal makes it possible to
use the complete functionality of the S7-300 controllers. STEP 7 Professional is the
common tool for hardware configuration, generation of the user program, and for
program testing and diagnostics.
STEP 7 Professional provides five programming languages for generation of the us-
er program: Ladder logic (LAD) with a graphic representation similar to a circuit di-
agram, function block diagram (FBD) with a graphic representation based on elec-
tronic circuitry systems, statement list (STL) with formulation of the control task as
a list of commands at machine level, a high-level Structured Control Language
(SCL) similar to Pascal, and finally GRAPH as a sequencer with sequential process-
ing of the user program.
STEP 7 Professional supports testing of the user program by means of watch tables
for monitoring, control and forcing of tag values, by representation of the program
with the current tag values during ongoing operation, and by offline simulation of
the programmable controller.
This book describes the configuration, programming, and testing of the S7-300 au-
tomation system with the STEP 7 Professional engineering software Version 12 with
Service Pack 1 Update 2.
Erlangen, June 2014 Hans Berger
This Book is Available on YakiBooki.com 5
The contents of the book at a glance
300 inside TIA Portal: Configuring, Programming and Testing with STEP 7 Pro
The contents of the book at a glance
omating-with-simatic-s7-300-inside-tia-portal-configuring-programming-and-tes
Start
Overview of the SIMATIC S7-300 automation system.
Introduction to the SIMATIC STEP 7 Professional V12 engineering software.
The basis of the automation solution: Creating and editing a project.
SIMATIC S7-300 automation system
Overview of the SIMATIC S7-300 modules: Design of an automation system, CPUs, signal,
function and communication modules.
Device configuration
Configuration of a station, parameterization of modules, and networking of stations.
Tags, addressing, and data types
The properties of inputs, outputs, I/O, bit memories, data, and temporary local data as oper-
and areas, and how they are addressed: absolute, symbolic, and indirect.
Description of elementary and compound data types, data types for block parameters, point-
ers, and user data types.
Program execution
How the CPU responds in the STARTUP, RUN, and STOP modes.
How the user program is structured with blocks, what the properties of these blocks are, and
how they are called.
How the user program is executed: startup characteristics, main program, interrupt process-
ing, troubleshooting, and diagnostics.
The program editor
Working with the PLC tag table, creating and editing code and data blocks, compiling blocks,
and evaluating program information.
The ladder logic programming language LAD
The characteristics of LAD programming; series and parallel connection of contacts, the use
of coils, standard boxes, Q boxes, and EN/ENO boxes.
The function block diagram programming language FBD
The characteristics of FBD programming; boxes for binary logic operations, the use of stan-
dard boxes, Q boxes, and EN/ENO boxes.
The statement list programming language STL
The characteristics of STL programming; programming of binary logic operations, applica-
tion of digital functions, and control of program execution.
6 This Book is Available on YakiBooki.com
The contents of the book at a glance
300 inside TIA Portal: Configuring, Programming and Testing with STEP 7 Pro
omating-with-simatic-s7-300-inside-tia-portal-configuring-programming-and-tes
The structured control language SCL
The characteristics of SCL programming; operators and expressions, working with binary
and digital functions, control of program execution using control statements.
The S7-GRAPH sequential controller
What a sequential control is, and what its elements are: sequencers, steps, transitions, and
branches. How a sequential control is configured using S7-GRAPH.
Description of the control functions
Basic functions: Functions for binary signals: binary logic operations, memory functions,
edge evaluations, SIMATIC and IEC timer and counter functions.
Digital functions: Functions for digital tags: transfer, comparison, arithmetic, math, conver-
sion, shift, and logic functions.
Program flow control: Working with status bits, programming jump functions, calling and
closing blocks, using the master control relay.
Online operation and program test
Connecting a programming device to the PLC station, switching on online mode, transfer-
ring the project data, and protecting the user program.
Loading, modifying, deleting, and comparing the user blocks.
Working with the hardware diagnostics and testing the user program.
Distributed I/O
Overview: The ET 200 distributed I/O system.
How a PROFINET IO system is configured, and what properties it has.
How a PROFIBUS DP master system is configured, and what properties it has.
How an actuator/sensor interface system is configured, and what properties it has.
Communication
The properties of S7 basic communication and of S7 communication, and with what commu-
nication functions they are programmed.
The communication functions used to implement open user communication.
Appendix
How external source files are created and imported for STL and SCL blocks.
How a project created using STEP 7 V5.x is migrated to the TIA Portal.
How the user program is tested offline using the S7-PLCSIM simulation software.
How the Web server is configured in the CPU, and what features it offers.
How block parameters and local tags are saved in the memory.
This Book is Available on YakiBooki.com 7
Table of contents
300 inside TIA Portal: Configuring, Programming and Testing with STEP 7 Pro
Table of contents
omating-with-simatic-s7-300-inside-tia-portal-configuring-programming-and-tes
1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.1 Overview of the S7-300 automation system . . . . . . . . . . . . . . . . . . . . . . . . . . . 22
1.1.1 SIMATIC S7-300 programmable controller . . . . . . . . . . . . . . . . . . . . . . . . . 23
1.1.2 Overview of STEP 7 Professional V12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1.1.3 Five programming languages . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26
1.1.4 Execution of the user program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28
1.1.5 Data management in the SIMATIC automation system . . . . . . . . . . . . . . . 30
1.2 Introduction to STEP 7 Professional V12 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.2.1 Installing STEP 7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.2.2 Automation License Manager . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31
1.2.3 Starting STEP 7 Professional . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
1.2.4 Portal view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32
1.2.5 The windows of the Project view . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 33
1.2.6 Help information system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
1.2.7 Adapting the user interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36
1.3 Editing a SIMATIC project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37
1.3.1 Structured representation of project data . . . . . . . . . . . . . . . . . . . . . . . . . 38
1.3.2 Project data and editors for a PLC station . . . . . . . . . . . . . . . . . . . . . . . . . . 39
1.3.3 Creating and editing a project . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42
1.3.4 Working with reference projects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44
1.3.5 Creating and editing libraries . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45
2 SIMATIC S7-300 automation system . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.1 S7-300 station components . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
2.2 S7-300 CPUs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.2.1 CPU versions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48
2.2.2 Control and display elements . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50
2.2.3 SIMATIC Micro Memory Card . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.2.4 Memory areas in an S7-300 station . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51
2.2.5 Bus interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53
2.3 Signal modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
2.3.1 Digital input modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
2.3.2 Digital output modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
2.3.3 Digital input/output modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56
2.3.4 Analog input modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
2.3.5 Analog output modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57
2.3.6 Analog input/output modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 58
2.4 Function modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59
2.5 Communication modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60
8 This Book is Available on YakiBooki.com
Table of contents
300 inside TIA Portal: Configuring, Programming and Testing with STEP 7 Pro
2.6 Other modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
2.6.1 Interface modules (IM) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61
2.6.2 Power supply modules (PS) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2.6.3 Simulator module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2.6.4 Dummy module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
2.7 SIPLUS S7-300 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63
omating-with-simatic-s7-300-inside-tia-portal-configuring-programming-and-tes
3 Device configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
3.1 Introduction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
3.2 Configuring a station . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
3.2.1 Adding a PLC station . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
3.2.2 Adding a module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
3.2.3 Adding an expansion rack . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 69
3.3 Parameterization of modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
3.3.1 Parameterization of CPU properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 70
3.3.2 Addressing modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73
3.3.3 Assigning parameters to signal modules . . . . . . . . . . . . . . . . . . . . . . . . . . 75
3.4 Configuring the network . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
3.4.1 Introduction, overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76
3.4.2 Networking stations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
3.4.3 Node addresses in a subnet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 79
3.4.4 Connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
3.4.5 Configuring an MPI subnet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 82
3.4.6 Configuring a PROFIBUS subnet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 83
3.4.7 Configuring a PROFINET subnet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 85
3.4.8 Configuring an AS-i subnet . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89
4 Tags, addressing, and data types . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.1 Operands and tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.1.1 Introduction, overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 90
4.1.2 Operand areas: inputs and outputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91
4.1.3 Operand area: bit memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93
4.1.4 Operand area: data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
4.1.5 Operand area: temporary local data . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95
4.2 Addressing of operands and tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
4.2.1 Signal path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
4.2.2 Absolute addressing of tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
4.2.3 Symbolic addressing of tags . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 101
4.2.4 Addressing constants . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102
4.3 Indirect addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 103
4.3.1 Memory-indirect addressing with STL . . . . . . . . . . . . . . . . . . . . . . . . . . . 104
4.3.2 Register-indirect addressing with STL . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107
4.3.3 Working with the address registers with STL . . . . . . . . . . . . . . . . . . . . . . 109
4.3.4 Direct access to complex local tags with STL . . . . . . . . . . . . . . . . . . . . . . 116
4.3.5 Indirect addressing with SCL . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118
This Book is Available on YakiBooki.com 9