cover - cdn1.ozone.ru

40

Transcript of cover - cdn1.ozone.ru

Page 1: cover - cdn1.ozone.ru
Dateianlage
covergif

BergerAutomating with SIMATIC S7-400 inside TIA Portal

Automating with SIMATIC S7-400 inside TIA PortalConfiguring Programming and Testing with STEP 7 Professional

by Hans Berger

Publicis Publishing

Bibliographic information from the Deutsche Nationalbibliothek

The Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie detailed bibliographic data are available on the Internet at httpdnbd-nbde

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 publisher author and translators accept no liability for whatever legal reasons for any damage resulting from the use of the programming examples

wwwpublicis-booksde

ISBN 978-3-89578-383-8

Editor Siemens Aktiengesellschaft Berlin and Munich Publisher Publicis Publishing Erlangencopy 2013 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 systemsIt also applies to the use of extracts from the text

Printed in Germany

Preface

5

Preface

The SIMATIC automation system unites all the subsystems of an automation solu-tion under a uniform system architecture to form a homogenous whole from thefield level right up to process control

The Totally Integrated Automation (TIA) concept permits uniform handling of allautomation components using a single system platform and tools with uniformoperator interfaces These requirements are fulfilled by the SIMATIC automationsystem which provides uniformity for configuration programming data manage-ment and communication

This book describes the hardware components of the SIMATIC S7-400 automationsystem with standard controllers and the features provided for designing a distrib-uted control concept with PROFIBUS and PROFINET To permit communication withother automation systems the controllers offer integrated bus interfaces for multi-point interface (MPI) PROFIBUS and Industrial Ethernet

The STEP 7 Professional engineering software makes it possible to use the completefunctionality of the S7-400 controllers STEP 7 Professional is the common tool forhardware configuration generation of the user program and for program testingand diagnostics

STEP 7 Professional provides five languages for generation of the user programLadder logic (LAD) with a graphic representation similar to a circuit diagram func-tion block diagram (FBD) with a graphic representation based on electronic circuit-ry systems statement list (STL) with formulation of the control task as a list of com-mands at machine level a high-level Structured Control Language (SCL) similar toPascal and finally GRAPH as a sequencer with sequential processing of the userprogram

STEP 7 Professional supports testing of the user program by means of watch tablesfor monitoring control and forcing of tag values by representation of the programwith the current tag values during ongoing operation and by offline simulation ofthe programmable controller

This book describes the configuration programming and testing of the S7-400automation system with the STEP 7 Professional engineering software Version 11with Service Pack 4

Erlangen June 2013 Hans Berger

The contents of the book at a glance

6

The contents of the book at a glance

Start

Overview of the SIMATIC S7-400 automation system

Introduction to the SIMATIC STEP 7 Professional V11 engineering software

The basis of the automation solution Creating and editing a project

SIMATIC S7-400 automation system

Overview of SIMATIC S7-400 modules Design of an automation system CPUs signal func-tion 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 IO 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 module 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 ENENO 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 ENENO 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

The contents of the book at a glance

7

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 testing

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 IO

Overview The ET 200 distributed IO 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

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

How PtP communication is implemented

Annex

How external source files are created and imported for STL and SCL blocks

How a project created using STEP 7 V5x 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

Table of contents

8

Table of contents

1 Introduction 2111 Overview of the S7-400 automation system 21

111 SIMATIC S7-400 programmable controller 22112 Overview of STEP 7 Professional V11 23113 Five programming languages 25114 Execution of the user program 27115 Data management in the SIMATIC automation system 30

12 Introduction to STEP 7 Professional V11 30121 Installing STEP 7 30122 Automation License Manager 31123 Starting STEP 7 Professional 31124 Portal view 31125 Help information system 33126 The windows of the Project view 33127 Adapting the user interface 36

13 Editing a SIMATIC project 36131 Structured representation of project data 37132 Project data and editors for a PLC station 37133 Creating and editing a project 41134 Creating and editing libraries 43

2 SIMATIC S7-400 automation system 4421 Components of an S7-400 station 4422 S7-400 CPUs 48

221 CPU versions 48222 Control and display elements 50223 SIMATIC memory card 51224 Memory areas in an S7-400 station 51225 Bus interfaces 53226 IF 964-DP interface module 54

23 Signal modules 54231 Digital input modules 54232 Digital output modules 55233 Analog input modules 56234 Analog output module 57

24 Function modules 5725 Communication modules 5826 Other modules 59

261 Interface modules 59262 Power supply modules 60

27 SIPLUS S7-400 61

Table of contents

9

3 Device configuration 6231 Introduction 6232 Configuring a station 65

321 Adding a PLC station 65322 Adding a module 65323 Adding an expansion unit 66

33 Parameterization of modules 67331 Parameterization of CPU properties 67332 Addressing modules 70333 Assigning parameters to signal modules 73

34 Configuring the network 74341 Introduction overview 74342 Networking stations 75343 Node addresses in a subnet 76344 Connections 77345 Configuring an MPI subnet 80346 Configuring a PROFIBUS subnet 81347 Configuring a PROFINET subnet 82348 Configuring a PtP subnet 86

4 Tags addressing and data types 8941 Operands and tags 89

411 Introduction overview 89412 Operand areas inputs and outputs 90413 Operand area bit memory 92414 Operand area data 93415 Operand area temporary local data 94

42 Addressing of operands and tags 95421 Signal path 95422 Absolute addressing of tags 96423 Symbolic addressing of tags 101424 Addressing constants 102

43 Indirect addressing 103431 Memory-indirect addressing with STL 104432 Register-indirect addressing with STL 106433 Working with the address registers with STL 108434 Direct access to complex local tags with STL 115435 Indirect addressing with SCL 117

44 Elementary data types 119441 Introduction 119442 Bit-serial data types BOOL BYTE WORD and DWORD 122443 BCD numbers BCD16 and BCD32 122444 Fixed-point data types with sign INT and DINT 122445 Floating-point data type REAL 124446 Data type CHAR 125447 Data types for durations and points in time 126

45 Complex data types 127451 STRING data type 128452 Data type ARRAY 129453 Data type STRUCT 131

Table of contents

10

46 Parameter types and pointers 133461 Parameter types 133462 Pointer 135463 ldquoVariablerdquo ANY pointer with STL 138464 ldquoVariablerdquo ANY pointer with SCL 138

47 PLC data types 14148 Start information 141

5 Program execution 14351 Operating states of the CPU 143

511 STOP operating state 144512 STARTUP operating state 145513 RUN operating state 149514 HOLD operating state 149515 Reset CPU memory 149516 Restoring the factory settings 150517 Retentive behavior of operands 151

52 Creating a user program 151521 Program draft 151522 Program execution 155523 Block types 156524 Editing block properties 158525 Block interface 162526 Example of use of block parameters 163

53 Calling blocks 165531 General information on calling of code blocks 165532 Calling functions (FC) 165533 Calling function blocks (FB) 167534 ldquoPassing onrdquo of block parameters 170

54 Startup program 171541 Startup organization blocks OB 100 OB 101 and OB 102 171542 Determining a module address 172543 Parameterization of modules 173

55 Main program 177551 Organization block OB 1 177552 Process image 177553 Cycle time and response time 182554 Minimum cycle time and background processing 184555 Compress hold stop and protect program 186556 Time 187557 Determine system time and OB runtime 191558 Runtime meter 195

56 Interrupt processing 196561 Introduction to interrupt processing 196562 Priority classes 197563 Time-of-day interrupts organization blocks OB 10 to OB 17 199564 Time-delay interrupts organization blocks OB 20 to OB 23 202565 Cyclic interrupts organization blocks OB 30 to OB 38 205566 Hardware interrupts organization blocks OB 40 to OB 47 207567 Interrupts for DPV1 organization blocks OB 55 to OB 57 208568 Synchronous cycle interrupts organization blocks OB 61 to OB 64 209

Table of contents

11

569 Reading additional interrupt information 21257 Error handling 213

571 Causes of errors and error responses 213572 Synchronous error 213573 Enabling and disabling synchronous error processing 215574 Enter substitute value 218575 Asynchronous errors 218576 Disable delay and enable interrupts and asynchronous errors 224

58 Diagnostics 226581 Diagnostics interrupt organization block OB 82 226582 Read system state list 227583 Read start information 228584 Determine connection status 229585 System diagnostics with Report System Errors 231

59 Configure alarms 233591 Introduction 233592 Configuring alarms according to the message numbering 236593 Message blocks for PLC alarms with instance data 241594 Message blocks for PLC alarms without instance data 244595 Blocks for working with alarms 246596 Configuring a user diagnostic alarm 249597 CPU alarm display 250

6 Program editor 25361 Introduction 25362 PLC tag table 254

621 Editing PLC tag tables 254622 Defining PLC tags 254623 Exporting and importing a PLC tag table 256624 Constants tables 257

63 Programming a code block 257631 Creating a new code block 257632 Working area of program editor for code blocks 258633 Specifying code block properties 260634 Programming a block interface 260635 Programming a control function 262636 Editing tags 266637 Working with program comments 268

64 Programming a data block 270641 Creating a new data block 270642 Working area of program editor for data blocks 270643 Defining properties for data blocks 271644 Declaring data tags 272645 Entering data tags in global data blocks 273

65 Compiling blocks 273651 Starting the compilation 273652 Compiling SCL blocks 274653 Eliminating errors following compilation 275

66 Program information 276661 Cross-reference list 276662 Assignment list 278

Table of contents

12

663 Call structure 279664 Dependency structure 280665 Consistency check 281666 Memory utilization of the CPU 281

7 Ladder logic LAD 28371 Introduction 283

711 Programming with LAD in general 283712 Program elements of ladder logic 285

72 Programming binary logic operations with LAD 286721 NO and NC contacts 286722 Series and parallel connection of contacts 287723 T branch open parallel branch 288724 Negating result of logic operation 289725 Edge evaluation of a binary tag 289726 Comparison contacts 290

73 Programming memory functions with LAD 290731 Simple coil assignment 291732 Set and reset coils 292733 Retentive response due to latching 292734 Coils with time response 293735 Coils with counter response 294

74 Programming Q boxes with LAD 295741 Memory boxes 296742 Edge evaluation of current flow 296743 SIMATIC timer functions 297744 SIMATIC counter functions 298745 IEC timer functions 299746 IEC counter functions 300

75 Programming ENENO boxes with LAD 301751 Transfer function MOVE 302752 Arithmetic functions 302753 Math functions 303754 Conversion functions 304755 Shift functions 305756 Word logic operations 306

76 Controlling the program flow with LAD 307761 Working with status bits in the ladder logic 307762 ENENO mechanism with LAD 309763 Jump functions 310764 Block functions 311765 Master Control Relay (MCR) 313

8 Function block diagram FBD 31581 Introduction 315

811 Programming with FBD in general 315812 Program elements of the function block diagram 317

82 Programming binary logic operations with FBD 318821 Scanning for signal states ldquo1rdquo and ldquo0rdquo 318822 Programming a binary logic operation in the function block diagram 319

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 2: cover - cdn1.ozone.ru

BergerAutomating with SIMATIC S7-400 inside TIA Portal

Automating with SIMATIC S7-400 inside TIA PortalConfiguring Programming and Testing with STEP 7 Professional

by Hans Berger

Publicis Publishing

Bibliographic information from the Deutsche Nationalbibliothek

The Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie detailed bibliographic data are available on the Internet at httpdnbd-nbde

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 publisher author and translators accept no liability for whatever legal reasons for any damage resulting from the use of the programming examples

wwwpublicis-booksde

ISBN 978-3-89578-383-8

Editor Siemens Aktiengesellschaft Berlin and Munich Publisher Publicis Publishing Erlangencopy 2013 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 systemsIt also applies to the use of extracts from the text

Printed in Germany

Preface

5

Preface

The SIMATIC automation system unites all the subsystems of an automation solu-tion under a uniform system architecture to form a homogenous whole from thefield level right up to process control

The Totally Integrated Automation (TIA) concept permits uniform handling of allautomation components using a single system platform and tools with uniformoperator interfaces These requirements are fulfilled by the SIMATIC automationsystem which provides uniformity for configuration programming data manage-ment and communication

This book describes the hardware components of the SIMATIC S7-400 automationsystem with standard controllers and the features provided for designing a distrib-uted control concept with PROFIBUS and PROFINET To permit communication withother automation systems the controllers offer integrated bus interfaces for multi-point interface (MPI) PROFIBUS and Industrial Ethernet

The STEP 7 Professional engineering software makes it possible to use the completefunctionality of the S7-400 controllers STEP 7 Professional is the common tool forhardware configuration generation of the user program and for program testingand diagnostics

STEP 7 Professional provides five languages for generation of the user programLadder logic (LAD) with a graphic representation similar to a circuit diagram func-tion block diagram (FBD) with a graphic representation based on electronic circuit-ry systems statement list (STL) with formulation of the control task as a list of com-mands at machine level a high-level Structured Control Language (SCL) similar toPascal and finally GRAPH as a sequencer with sequential processing of the userprogram

STEP 7 Professional supports testing of the user program by means of watch tablesfor monitoring control and forcing of tag values by representation of the programwith the current tag values during ongoing operation and by offline simulation ofthe programmable controller

This book describes the configuration programming and testing of the S7-400automation system with the STEP 7 Professional engineering software Version 11with Service Pack 4

Erlangen June 2013 Hans Berger

The contents of the book at a glance

6

The contents of the book at a glance

Start

Overview of the SIMATIC S7-400 automation system

Introduction to the SIMATIC STEP 7 Professional V11 engineering software

The basis of the automation solution Creating and editing a project

SIMATIC S7-400 automation system

Overview of SIMATIC S7-400 modules Design of an automation system CPUs signal func-tion 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 IO 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 module 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 ENENO 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 ENENO 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

The contents of the book at a glance

7

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 testing

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 IO

Overview The ET 200 distributed IO 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

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

How PtP communication is implemented

Annex

How external source files are created and imported for STL and SCL blocks

How a project created using STEP 7 V5x 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

Table of contents

8

Table of contents

1 Introduction 2111 Overview of the S7-400 automation system 21

111 SIMATIC S7-400 programmable controller 22112 Overview of STEP 7 Professional V11 23113 Five programming languages 25114 Execution of the user program 27115 Data management in the SIMATIC automation system 30

12 Introduction to STEP 7 Professional V11 30121 Installing STEP 7 30122 Automation License Manager 31123 Starting STEP 7 Professional 31124 Portal view 31125 Help information system 33126 The windows of the Project view 33127 Adapting the user interface 36

13 Editing a SIMATIC project 36131 Structured representation of project data 37132 Project data and editors for a PLC station 37133 Creating and editing a project 41134 Creating and editing libraries 43

2 SIMATIC S7-400 automation system 4421 Components of an S7-400 station 4422 S7-400 CPUs 48

221 CPU versions 48222 Control and display elements 50223 SIMATIC memory card 51224 Memory areas in an S7-400 station 51225 Bus interfaces 53226 IF 964-DP interface module 54

23 Signal modules 54231 Digital input modules 54232 Digital output modules 55233 Analog input modules 56234 Analog output module 57

24 Function modules 5725 Communication modules 5826 Other modules 59

261 Interface modules 59262 Power supply modules 60

27 SIPLUS S7-400 61

Table of contents

9

3 Device configuration 6231 Introduction 6232 Configuring a station 65

321 Adding a PLC station 65322 Adding a module 65323 Adding an expansion unit 66

33 Parameterization of modules 67331 Parameterization of CPU properties 67332 Addressing modules 70333 Assigning parameters to signal modules 73

34 Configuring the network 74341 Introduction overview 74342 Networking stations 75343 Node addresses in a subnet 76344 Connections 77345 Configuring an MPI subnet 80346 Configuring a PROFIBUS subnet 81347 Configuring a PROFINET subnet 82348 Configuring a PtP subnet 86

4 Tags addressing and data types 8941 Operands and tags 89

411 Introduction overview 89412 Operand areas inputs and outputs 90413 Operand area bit memory 92414 Operand area data 93415 Operand area temporary local data 94

42 Addressing of operands and tags 95421 Signal path 95422 Absolute addressing of tags 96423 Symbolic addressing of tags 101424 Addressing constants 102

43 Indirect addressing 103431 Memory-indirect addressing with STL 104432 Register-indirect addressing with STL 106433 Working with the address registers with STL 108434 Direct access to complex local tags with STL 115435 Indirect addressing with SCL 117

44 Elementary data types 119441 Introduction 119442 Bit-serial data types BOOL BYTE WORD and DWORD 122443 BCD numbers BCD16 and BCD32 122444 Fixed-point data types with sign INT and DINT 122445 Floating-point data type REAL 124446 Data type CHAR 125447 Data types for durations and points in time 126

45 Complex data types 127451 STRING data type 128452 Data type ARRAY 129453 Data type STRUCT 131

Table of contents

10

46 Parameter types and pointers 133461 Parameter types 133462 Pointer 135463 ldquoVariablerdquo ANY pointer with STL 138464 ldquoVariablerdquo ANY pointer with SCL 138

47 PLC data types 14148 Start information 141

5 Program execution 14351 Operating states of the CPU 143

511 STOP operating state 144512 STARTUP operating state 145513 RUN operating state 149514 HOLD operating state 149515 Reset CPU memory 149516 Restoring the factory settings 150517 Retentive behavior of operands 151

52 Creating a user program 151521 Program draft 151522 Program execution 155523 Block types 156524 Editing block properties 158525 Block interface 162526 Example of use of block parameters 163

53 Calling blocks 165531 General information on calling of code blocks 165532 Calling functions (FC) 165533 Calling function blocks (FB) 167534 ldquoPassing onrdquo of block parameters 170

54 Startup program 171541 Startup organization blocks OB 100 OB 101 and OB 102 171542 Determining a module address 172543 Parameterization of modules 173

55 Main program 177551 Organization block OB 1 177552 Process image 177553 Cycle time and response time 182554 Minimum cycle time and background processing 184555 Compress hold stop and protect program 186556 Time 187557 Determine system time and OB runtime 191558 Runtime meter 195

56 Interrupt processing 196561 Introduction to interrupt processing 196562 Priority classes 197563 Time-of-day interrupts organization blocks OB 10 to OB 17 199564 Time-delay interrupts organization blocks OB 20 to OB 23 202565 Cyclic interrupts organization blocks OB 30 to OB 38 205566 Hardware interrupts organization blocks OB 40 to OB 47 207567 Interrupts for DPV1 organization blocks OB 55 to OB 57 208568 Synchronous cycle interrupts organization blocks OB 61 to OB 64 209

Table of contents

11

569 Reading additional interrupt information 21257 Error handling 213

571 Causes of errors and error responses 213572 Synchronous error 213573 Enabling and disabling synchronous error processing 215574 Enter substitute value 218575 Asynchronous errors 218576 Disable delay and enable interrupts and asynchronous errors 224

58 Diagnostics 226581 Diagnostics interrupt organization block OB 82 226582 Read system state list 227583 Read start information 228584 Determine connection status 229585 System diagnostics with Report System Errors 231

59 Configure alarms 233591 Introduction 233592 Configuring alarms according to the message numbering 236593 Message blocks for PLC alarms with instance data 241594 Message blocks for PLC alarms without instance data 244595 Blocks for working with alarms 246596 Configuring a user diagnostic alarm 249597 CPU alarm display 250

6 Program editor 25361 Introduction 25362 PLC tag table 254

621 Editing PLC tag tables 254622 Defining PLC tags 254623 Exporting and importing a PLC tag table 256624 Constants tables 257

63 Programming a code block 257631 Creating a new code block 257632 Working area of program editor for code blocks 258633 Specifying code block properties 260634 Programming a block interface 260635 Programming a control function 262636 Editing tags 266637 Working with program comments 268

64 Programming a data block 270641 Creating a new data block 270642 Working area of program editor for data blocks 270643 Defining properties for data blocks 271644 Declaring data tags 272645 Entering data tags in global data blocks 273

65 Compiling blocks 273651 Starting the compilation 273652 Compiling SCL blocks 274653 Eliminating errors following compilation 275

66 Program information 276661 Cross-reference list 276662 Assignment list 278

Table of contents

12

663 Call structure 279664 Dependency structure 280665 Consistency check 281666 Memory utilization of the CPU 281

7 Ladder logic LAD 28371 Introduction 283

711 Programming with LAD in general 283712 Program elements of ladder logic 285

72 Programming binary logic operations with LAD 286721 NO and NC contacts 286722 Series and parallel connection of contacts 287723 T branch open parallel branch 288724 Negating result of logic operation 289725 Edge evaluation of a binary tag 289726 Comparison contacts 290

73 Programming memory functions with LAD 290731 Simple coil assignment 291732 Set and reset coils 292733 Retentive response due to latching 292734 Coils with time response 293735 Coils with counter response 294

74 Programming Q boxes with LAD 295741 Memory boxes 296742 Edge evaluation of current flow 296743 SIMATIC timer functions 297744 SIMATIC counter functions 298745 IEC timer functions 299746 IEC counter functions 300

75 Programming ENENO boxes with LAD 301751 Transfer function MOVE 302752 Arithmetic functions 302753 Math functions 303754 Conversion functions 304755 Shift functions 305756 Word logic operations 306

76 Controlling the program flow with LAD 307761 Working with status bits in the ladder logic 307762 ENENO mechanism with LAD 309763 Jump functions 310764 Block functions 311765 Master Control Relay (MCR) 313

8 Function block diagram FBD 31581 Introduction 315

811 Programming with FBD in general 315812 Program elements of the function block diagram 317

82 Programming binary logic operations with FBD 318821 Scanning for signal states ldquo1rdquo and ldquo0rdquo 318822 Programming a binary logic operation in the function block diagram 319

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 3: cover - cdn1.ozone.ru

Automating with SIMATIC S7-400 inside TIA PortalConfiguring Programming and Testing with STEP 7 Professional

by Hans Berger

Publicis Publishing

Bibliographic information from the Deutsche Nationalbibliothek

The Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie detailed bibliographic data are available on the Internet at httpdnbd-nbde

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 publisher author and translators accept no liability for whatever legal reasons for any damage resulting from the use of the programming examples

wwwpublicis-booksde

ISBN 978-3-89578-383-8

Editor Siemens Aktiengesellschaft Berlin and Munich Publisher Publicis Publishing Erlangencopy 2013 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 systemsIt also applies to the use of extracts from the text

Printed in Germany

Preface

5

Preface

The SIMATIC automation system unites all the subsystems of an automation solu-tion under a uniform system architecture to form a homogenous whole from thefield level right up to process control

The Totally Integrated Automation (TIA) concept permits uniform handling of allautomation components using a single system platform and tools with uniformoperator interfaces These requirements are fulfilled by the SIMATIC automationsystem which provides uniformity for configuration programming data manage-ment and communication

This book describes the hardware components of the SIMATIC S7-400 automationsystem with standard controllers and the features provided for designing a distrib-uted control concept with PROFIBUS and PROFINET To permit communication withother automation systems the controllers offer integrated bus interfaces for multi-point interface (MPI) PROFIBUS and Industrial Ethernet

The STEP 7 Professional engineering software makes it possible to use the completefunctionality of the S7-400 controllers STEP 7 Professional is the common tool forhardware configuration generation of the user program and for program testingand diagnostics

STEP 7 Professional provides five languages for generation of the user programLadder logic (LAD) with a graphic representation similar to a circuit diagram func-tion block diagram (FBD) with a graphic representation based on electronic circuit-ry systems statement list (STL) with formulation of the control task as a list of com-mands at machine level a high-level Structured Control Language (SCL) similar toPascal and finally GRAPH as a sequencer with sequential processing of the userprogram

STEP 7 Professional supports testing of the user program by means of watch tablesfor monitoring control and forcing of tag values by representation of the programwith the current tag values during ongoing operation and by offline simulation ofthe programmable controller

This book describes the configuration programming and testing of the S7-400automation system with the STEP 7 Professional engineering software Version 11with Service Pack 4

Erlangen June 2013 Hans Berger

The contents of the book at a glance

6

The contents of the book at a glance

Start

Overview of the SIMATIC S7-400 automation system

Introduction to the SIMATIC STEP 7 Professional V11 engineering software

The basis of the automation solution Creating and editing a project

SIMATIC S7-400 automation system

Overview of SIMATIC S7-400 modules Design of an automation system CPUs signal func-tion 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 IO 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 module 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 ENENO 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 ENENO 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

The contents of the book at a glance

7

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 testing

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 IO

Overview The ET 200 distributed IO 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

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

How PtP communication is implemented

Annex

How external source files are created and imported for STL and SCL blocks

How a project created using STEP 7 V5x 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

Table of contents

8

Table of contents

1 Introduction 2111 Overview of the S7-400 automation system 21

111 SIMATIC S7-400 programmable controller 22112 Overview of STEP 7 Professional V11 23113 Five programming languages 25114 Execution of the user program 27115 Data management in the SIMATIC automation system 30

12 Introduction to STEP 7 Professional V11 30121 Installing STEP 7 30122 Automation License Manager 31123 Starting STEP 7 Professional 31124 Portal view 31125 Help information system 33126 The windows of the Project view 33127 Adapting the user interface 36

13 Editing a SIMATIC project 36131 Structured representation of project data 37132 Project data and editors for a PLC station 37133 Creating and editing a project 41134 Creating and editing libraries 43

2 SIMATIC S7-400 automation system 4421 Components of an S7-400 station 4422 S7-400 CPUs 48

221 CPU versions 48222 Control and display elements 50223 SIMATIC memory card 51224 Memory areas in an S7-400 station 51225 Bus interfaces 53226 IF 964-DP interface module 54

23 Signal modules 54231 Digital input modules 54232 Digital output modules 55233 Analog input modules 56234 Analog output module 57

24 Function modules 5725 Communication modules 5826 Other modules 59

261 Interface modules 59262 Power supply modules 60

27 SIPLUS S7-400 61

Table of contents

9

3 Device configuration 6231 Introduction 6232 Configuring a station 65

321 Adding a PLC station 65322 Adding a module 65323 Adding an expansion unit 66

33 Parameterization of modules 67331 Parameterization of CPU properties 67332 Addressing modules 70333 Assigning parameters to signal modules 73

34 Configuring the network 74341 Introduction overview 74342 Networking stations 75343 Node addresses in a subnet 76344 Connections 77345 Configuring an MPI subnet 80346 Configuring a PROFIBUS subnet 81347 Configuring a PROFINET subnet 82348 Configuring a PtP subnet 86

4 Tags addressing and data types 8941 Operands and tags 89

411 Introduction overview 89412 Operand areas inputs and outputs 90413 Operand area bit memory 92414 Operand area data 93415 Operand area temporary local data 94

42 Addressing of operands and tags 95421 Signal path 95422 Absolute addressing of tags 96423 Symbolic addressing of tags 101424 Addressing constants 102

43 Indirect addressing 103431 Memory-indirect addressing with STL 104432 Register-indirect addressing with STL 106433 Working with the address registers with STL 108434 Direct access to complex local tags with STL 115435 Indirect addressing with SCL 117

44 Elementary data types 119441 Introduction 119442 Bit-serial data types BOOL BYTE WORD and DWORD 122443 BCD numbers BCD16 and BCD32 122444 Fixed-point data types with sign INT and DINT 122445 Floating-point data type REAL 124446 Data type CHAR 125447 Data types for durations and points in time 126

45 Complex data types 127451 STRING data type 128452 Data type ARRAY 129453 Data type STRUCT 131

Table of contents

10

46 Parameter types and pointers 133461 Parameter types 133462 Pointer 135463 ldquoVariablerdquo ANY pointer with STL 138464 ldquoVariablerdquo ANY pointer with SCL 138

47 PLC data types 14148 Start information 141

5 Program execution 14351 Operating states of the CPU 143

511 STOP operating state 144512 STARTUP operating state 145513 RUN operating state 149514 HOLD operating state 149515 Reset CPU memory 149516 Restoring the factory settings 150517 Retentive behavior of operands 151

52 Creating a user program 151521 Program draft 151522 Program execution 155523 Block types 156524 Editing block properties 158525 Block interface 162526 Example of use of block parameters 163

53 Calling blocks 165531 General information on calling of code blocks 165532 Calling functions (FC) 165533 Calling function blocks (FB) 167534 ldquoPassing onrdquo of block parameters 170

54 Startup program 171541 Startup organization blocks OB 100 OB 101 and OB 102 171542 Determining a module address 172543 Parameterization of modules 173

55 Main program 177551 Organization block OB 1 177552 Process image 177553 Cycle time and response time 182554 Minimum cycle time and background processing 184555 Compress hold stop and protect program 186556 Time 187557 Determine system time and OB runtime 191558 Runtime meter 195

56 Interrupt processing 196561 Introduction to interrupt processing 196562 Priority classes 197563 Time-of-day interrupts organization blocks OB 10 to OB 17 199564 Time-delay interrupts organization blocks OB 20 to OB 23 202565 Cyclic interrupts organization blocks OB 30 to OB 38 205566 Hardware interrupts organization blocks OB 40 to OB 47 207567 Interrupts for DPV1 organization blocks OB 55 to OB 57 208568 Synchronous cycle interrupts organization blocks OB 61 to OB 64 209

Table of contents

11

569 Reading additional interrupt information 21257 Error handling 213

571 Causes of errors and error responses 213572 Synchronous error 213573 Enabling and disabling synchronous error processing 215574 Enter substitute value 218575 Asynchronous errors 218576 Disable delay and enable interrupts and asynchronous errors 224

58 Diagnostics 226581 Diagnostics interrupt organization block OB 82 226582 Read system state list 227583 Read start information 228584 Determine connection status 229585 System diagnostics with Report System Errors 231

59 Configure alarms 233591 Introduction 233592 Configuring alarms according to the message numbering 236593 Message blocks for PLC alarms with instance data 241594 Message blocks for PLC alarms without instance data 244595 Blocks for working with alarms 246596 Configuring a user diagnostic alarm 249597 CPU alarm display 250

6 Program editor 25361 Introduction 25362 PLC tag table 254

621 Editing PLC tag tables 254622 Defining PLC tags 254623 Exporting and importing a PLC tag table 256624 Constants tables 257

63 Programming a code block 257631 Creating a new code block 257632 Working area of program editor for code blocks 258633 Specifying code block properties 260634 Programming a block interface 260635 Programming a control function 262636 Editing tags 266637 Working with program comments 268

64 Programming a data block 270641 Creating a new data block 270642 Working area of program editor for data blocks 270643 Defining properties for data blocks 271644 Declaring data tags 272645 Entering data tags in global data blocks 273

65 Compiling blocks 273651 Starting the compilation 273652 Compiling SCL blocks 274653 Eliminating errors following compilation 275

66 Program information 276661 Cross-reference list 276662 Assignment list 278

Table of contents

12

663 Call structure 279664 Dependency structure 280665 Consistency check 281666 Memory utilization of the CPU 281

7 Ladder logic LAD 28371 Introduction 283

711 Programming with LAD in general 283712 Program elements of ladder logic 285

72 Programming binary logic operations with LAD 286721 NO and NC contacts 286722 Series and parallel connection of contacts 287723 T branch open parallel branch 288724 Negating result of logic operation 289725 Edge evaluation of a binary tag 289726 Comparison contacts 290

73 Programming memory functions with LAD 290731 Simple coil assignment 291732 Set and reset coils 292733 Retentive response due to latching 292734 Coils with time response 293735 Coils with counter response 294

74 Programming Q boxes with LAD 295741 Memory boxes 296742 Edge evaluation of current flow 296743 SIMATIC timer functions 297744 SIMATIC counter functions 298745 IEC timer functions 299746 IEC counter functions 300

75 Programming ENENO boxes with LAD 301751 Transfer function MOVE 302752 Arithmetic functions 302753 Math functions 303754 Conversion functions 304755 Shift functions 305756 Word logic operations 306

76 Controlling the program flow with LAD 307761 Working with status bits in the ladder logic 307762 ENENO mechanism with LAD 309763 Jump functions 310764 Block functions 311765 Master Control Relay (MCR) 313

8 Function block diagram FBD 31581 Introduction 315

811 Programming with FBD in general 315812 Program elements of the function block diagram 317

82 Programming binary logic operations with FBD 318821 Scanning for signal states ldquo1rdquo and ldquo0rdquo 318822 Programming a binary logic operation in the function block diagram 319

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 4: cover - cdn1.ozone.ru

Bibliographic information from the Deutsche Nationalbibliothek

The Deutsche Nationalbibliothek lists this publication in the Deutsche Nationalbibliografie detailed bibliographic data are available on the Internet at httpdnbd-nbde

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 publisher author and translators accept no liability for whatever legal reasons for any damage resulting from the use of the programming examples

wwwpublicis-booksde

ISBN 978-3-89578-383-8

Editor Siemens Aktiengesellschaft Berlin and Munich Publisher Publicis Publishing Erlangencopy 2013 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 systemsIt also applies to the use of extracts from the text

Printed in Germany

Preface

5

Preface

The SIMATIC automation system unites all the subsystems of an automation solu-tion under a uniform system architecture to form a homogenous whole from thefield level right up to process control

The Totally Integrated Automation (TIA) concept permits uniform handling of allautomation components using a single system platform and tools with uniformoperator interfaces These requirements are fulfilled by the SIMATIC automationsystem which provides uniformity for configuration programming data manage-ment and communication

This book describes the hardware components of the SIMATIC S7-400 automationsystem with standard controllers and the features provided for designing a distrib-uted control concept with PROFIBUS and PROFINET To permit communication withother automation systems the controllers offer integrated bus interfaces for multi-point interface (MPI) PROFIBUS and Industrial Ethernet

The STEP 7 Professional engineering software makes it possible to use the completefunctionality of the S7-400 controllers STEP 7 Professional is the common tool forhardware configuration generation of the user program and for program testingand diagnostics

STEP 7 Professional provides five languages for generation of the user programLadder logic (LAD) with a graphic representation similar to a circuit diagram func-tion block diagram (FBD) with a graphic representation based on electronic circuit-ry systems statement list (STL) with formulation of the control task as a list of com-mands at machine level a high-level Structured Control Language (SCL) similar toPascal and finally GRAPH as a sequencer with sequential processing of the userprogram

STEP 7 Professional supports testing of the user program by means of watch tablesfor monitoring control and forcing of tag values by representation of the programwith the current tag values during ongoing operation and by offline simulation ofthe programmable controller

This book describes the configuration programming and testing of the S7-400automation system with the STEP 7 Professional engineering software Version 11with Service Pack 4

Erlangen June 2013 Hans Berger

The contents of the book at a glance

6

The contents of the book at a glance

Start

Overview of the SIMATIC S7-400 automation system

Introduction to the SIMATIC STEP 7 Professional V11 engineering software

The basis of the automation solution Creating and editing a project

SIMATIC S7-400 automation system

Overview of SIMATIC S7-400 modules Design of an automation system CPUs signal func-tion 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 IO 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 module 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 ENENO 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 ENENO 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

The contents of the book at a glance

7

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 testing

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 IO

Overview The ET 200 distributed IO 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

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

How PtP communication is implemented

Annex

How external source files are created and imported for STL and SCL blocks

How a project created using STEP 7 V5x 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

Table of contents

8

Table of contents

1 Introduction 2111 Overview of the S7-400 automation system 21

111 SIMATIC S7-400 programmable controller 22112 Overview of STEP 7 Professional V11 23113 Five programming languages 25114 Execution of the user program 27115 Data management in the SIMATIC automation system 30

12 Introduction to STEP 7 Professional V11 30121 Installing STEP 7 30122 Automation License Manager 31123 Starting STEP 7 Professional 31124 Portal view 31125 Help information system 33126 The windows of the Project view 33127 Adapting the user interface 36

13 Editing a SIMATIC project 36131 Structured representation of project data 37132 Project data and editors for a PLC station 37133 Creating and editing a project 41134 Creating and editing libraries 43

2 SIMATIC S7-400 automation system 4421 Components of an S7-400 station 4422 S7-400 CPUs 48

221 CPU versions 48222 Control and display elements 50223 SIMATIC memory card 51224 Memory areas in an S7-400 station 51225 Bus interfaces 53226 IF 964-DP interface module 54

23 Signal modules 54231 Digital input modules 54232 Digital output modules 55233 Analog input modules 56234 Analog output module 57

24 Function modules 5725 Communication modules 5826 Other modules 59

261 Interface modules 59262 Power supply modules 60

27 SIPLUS S7-400 61

Table of contents

9

3 Device configuration 6231 Introduction 6232 Configuring a station 65

321 Adding a PLC station 65322 Adding a module 65323 Adding an expansion unit 66

33 Parameterization of modules 67331 Parameterization of CPU properties 67332 Addressing modules 70333 Assigning parameters to signal modules 73

34 Configuring the network 74341 Introduction overview 74342 Networking stations 75343 Node addresses in a subnet 76344 Connections 77345 Configuring an MPI subnet 80346 Configuring a PROFIBUS subnet 81347 Configuring a PROFINET subnet 82348 Configuring a PtP subnet 86

4 Tags addressing and data types 8941 Operands and tags 89

411 Introduction overview 89412 Operand areas inputs and outputs 90413 Operand area bit memory 92414 Operand area data 93415 Operand area temporary local data 94

42 Addressing of operands and tags 95421 Signal path 95422 Absolute addressing of tags 96423 Symbolic addressing of tags 101424 Addressing constants 102

43 Indirect addressing 103431 Memory-indirect addressing with STL 104432 Register-indirect addressing with STL 106433 Working with the address registers with STL 108434 Direct access to complex local tags with STL 115435 Indirect addressing with SCL 117

44 Elementary data types 119441 Introduction 119442 Bit-serial data types BOOL BYTE WORD and DWORD 122443 BCD numbers BCD16 and BCD32 122444 Fixed-point data types with sign INT and DINT 122445 Floating-point data type REAL 124446 Data type CHAR 125447 Data types for durations and points in time 126

45 Complex data types 127451 STRING data type 128452 Data type ARRAY 129453 Data type STRUCT 131

Table of contents

10

46 Parameter types and pointers 133461 Parameter types 133462 Pointer 135463 ldquoVariablerdquo ANY pointer with STL 138464 ldquoVariablerdquo ANY pointer with SCL 138

47 PLC data types 14148 Start information 141

5 Program execution 14351 Operating states of the CPU 143

511 STOP operating state 144512 STARTUP operating state 145513 RUN operating state 149514 HOLD operating state 149515 Reset CPU memory 149516 Restoring the factory settings 150517 Retentive behavior of operands 151

52 Creating a user program 151521 Program draft 151522 Program execution 155523 Block types 156524 Editing block properties 158525 Block interface 162526 Example of use of block parameters 163

53 Calling blocks 165531 General information on calling of code blocks 165532 Calling functions (FC) 165533 Calling function blocks (FB) 167534 ldquoPassing onrdquo of block parameters 170

54 Startup program 171541 Startup organization blocks OB 100 OB 101 and OB 102 171542 Determining a module address 172543 Parameterization of modules 173

55 Main program 177551 Organization block OB 1 177552 Process image 177553 Cycle time and response time 182554 Minimum cycle time and background processing 184555 Compress hold stop and protect program 186556 Time 187557 Determine system time and OB runtime 191558 Runtime meter 195

56 Interrupt processing 196561 Introduction to interrupt processing 196562 Priority classes 197563 Time-of-day interrupts organization blocks OB 10 to OB 17 199564 Time-delay interrupts organization blocks OB 20 to OB 23 202565 Cyclic interrupts organization blocks OB 30 to OB 38 205566 Hardware interrupts organization blocks OB 40 to OB 47 207567 Interrupts for DPV1 organization blocks OB 55 to OB 57 208568 Synchronous cycle interrupts organization blocks OB 61 to OB 64 209

Table of contents

11

569 Reading additional interrupt information 21257 Error handling 213

571 Causes of errors and error responses 213572 Synchronous error 213573 Enabling and disabling synchronous error processing 215574 Enter substitute value 218575 Asynchronous errors 218576 Disable delay and enable interrupts and asynchronous errors 224

58 Diagnostics 226581 Diagnostics interrupt organization block OB 82 226582 Read system state list 227583 Read start information 228584 Determine connection status 229585 System diagnostics with Report System Errors 231

59 Configure alarms 233591 Introduction 233592 Configuring alarms according to the message numbering 236593 Message blocks for PLC alarms with instance data 241594 Message blocks for PLC alarms without instance data 244595 Blocks for working with alarms 246596 Configuring a user diagnostic alarm 249597 CPU alarm display 250

6 Program editor 25361 Introduction 25362 PLC tag table 254

621 Editing PLC tag tables 254622 Defining PLC tags 254623 Exporting and importing a PLC tag table 256624 Constants tables 257

63 Programming a code block 257631 Creating a new code block 257632 Working area of program editor for code blocks 258633 Specifying code block properties 260634 Programming a block interface 260635 Programming a control function 262636 Editing tags 266637 Working with program comments 268

64 Programming a data block 270641 Creating a new data block 270642 Working area of program editor for data blocks 270643 Defining properties for data blocks 271644 Declaring data tags 272645 Entering data tags in global data blocks 273

65 Compiling blocks 273651 Starting the compilation 273652 Compiling SCL blocks 274653 Eliminating errors following compilation 275

66 Program information 276661 Cross-reference list 276662 Assignment list 278

Table of contents

12

663 Call structure 279664 Dependency structure 280665 Consistency check 281666 Memory utilization of the CPU 281

7 Ladder logic LAD 28371 Introduction 283

711 Programming with LAD in general 283712 Program elements of ladder logic 285

72 Programming binary logic operations with LAD 286721 NO and NC contacts 286722 Series and parallel connection of contacts 287723 T branch open parallel branch 288724 Negating result of logic operation 289725 Edge evaluation of a binary tag 289726 Comparison contacts 290

73 Programming memory functions with LAD 290731 Simple coil assignment 291732 Set and reset coils 292733 Retentive response due to latching 292734 Coils with time response 293735 Coils with counter response 294

74 Programming Q boxes with LAD 295741 Memory boxes 296742 Edge evaluation of current flow 296743 SIMATIC timer functions 297744 SIMATIC counter functions 298745 IEC timer functions 299746 IEC counter functions 300

75 Programming ENENO boxes with LAD 301751 Transfer function MOVE 302752 Arithmetic functions 302753 Math functions 303754 Conversion functions 304755 Shift functions 305756 Word logic operations 306

76 Controlling the program flow with LAD 307761 Working with status bits in the ladder logic 307762 ENENO mechanism with LAD 309763 Jump functions 310764 Block functions 311765 Master Control Relay (MCR) 313

8 Function block diagram FBD 31581 Introduction 315

811 Programming with FBD in general 315812 Program elements of the function block diagram 317

82 Programming binary logic operations with FBD 318821 Scanning for signal states ldquo1rdquo and ldquo0rdquo 318822 Programming a binary logic operation in the function block diagram 319

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 5: cover - cdn1.ozone.ru

Preface

5

Preface

The SIMATIC automation system unites all the subsystems of an automation solu-tion under a uniform system architecture to form a homogenous whole from thefield level right up to process control

The Totally Integrated Automation (TIA) concept permits uniform handling of allautomation components using a single system platform and tools with uniformoperator interfaces These requirements are fulfilled by the SIMATIC automationsystem which provides uniformity for configuration programming data manage-ment and communication

This book describes the hardware components of the SIMATIC S7-400 automationsystem with standard controllers and the features provided for designing a distrib-uted control concept with PROFIBUS and PROFINET To permit communication withother automation systems the controllers offer integrated bus interfaces for multi-point interface (MPI) PROFIBUS and Industrial Ethernet

The STEP 7 Professional engineering software makes it possible to use the completefunctionality of the S7-400 controllers STEP 7 Professional is the common tool forhardware configuration generation of the user program and for program testingand diagnostics

STEP 7 Professional provides five languages for generation of the user programLadder logic (LAD) with a graphic representation similar to a circuit diagram func-tion block diagram (FBD) with a graphic representation based on electronic circuit-ry systems statement list (STL) with formulation of the control task as a list of com-mands at machine level a high-level Structured Control Language (SCL) similar toPascal and finally GRAPH as a sequencer with sequential processing of the userprogram

STEP 7 Professional supports testing of the user program by means of watch tablesfor monitoring control and forcing of tag values by representation of the programwith the current tag values during ongoing operation and by offline simulation ofthe programmable controller

This book describes the configuration programming and testing of the S7-400automation system with the STEP 7 Professional engineering software Version 11with Service Pack 4

Erlangen June 2013 Hans Berger

The contents of the book at a glance

6

The contents of the book at a glance

Start

Overview of the SIMATIC S7-400 automation system

Introduction to the SIMATIC STEP 7 Professional V11 engineering software

The basis of the automation solution Creating and editing a project

SIMATIC S7-400 automation system

Overview of SIMATIC S7-400 modules Design of an automation system CPUs signal func-tion 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 IO 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 module 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 ENENO 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 ENENO 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

The contents of the book at a glance

7

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 testing

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 IO

Overview The ET 200 distributed IO 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

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

How PtP communication is implemented

Annex

How external source files are created and imported for STL and SCL blocks

How a project created using STEP 7 V5x 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

Table of contents

8

Table of contents

1 Introduction 2111 Overview of the S7-400 automation system 21

111 SIMATIC S7-400 programmable controller 22112 Overview of STEP 7 Professional V11 23113 Five programming languages 25114 Execution of the user program 27115 Data management in the SIMATIC automation system 30

12 Introduction to STEP 7 Professional V11 30121 Installing STEP 7 30122 Automation License Manager 31123 Starting STEP 7 Professional 31124 Portal view 31125 Help information system 33126 The windows of the Project view 33127 Adapting the user interface 36

13 Editing a SIMATIC project 36131 Structured representation of project data 37132 Project data and editors for a PLC station 37133 Creating and editing a project 41134 Creating and editing libraries 43

2 SIMATIC S7-400 automation system 4421 Components of an S7-400 station 4422 S7-400 CPUs 48

221 CPU versions 48222 Control and display elements 50223 SIMATIC memory card 51224 Memory areas in an S7-400 station 51225 Bus interfaces 53226 IF 964-DP interface module 54

23 Signal modules 54231 Digital input modules 54232 Digital output modules 55233 Analog input modules 56234 Analog output module 57

24 Function modules 5725 Communication modules 5826 Other modules 59

261 Interface modules 59262 Power supply modules 60

27 SIPLUS S7-400 61

Table of contents

9

3 Device configuration 6231 Introduction 6232 Configuring a station 65

321 Adding a PLC station 65322 Adding a module 65323 Adding an expansion unit 66

33 Parameterization of modules 67331 Parameterization of CPU properties 67332 Addressing modules 70333 Assigning parameters to signal modules 73

34 Configuring the network 74341 Introduction overview 74342 Networking stations 75343 Node addresses in a subnet 76344 Connections 77345 Configuring an MPI subnet 80346 Configuring a PROFIBUS subnet 81347 Configuring a PROFINET subnet 82348 Configuring a PtP subnet 86

4 Tags addressing and data types 8941 Operands and tags 89

411 Introduction overview 89412 Operand areas inputs and outputs 90413 Operand area bit memory 92414 Operand area data 93415 Operand area temporary local data 94

42 Addressing of operands and tags 95421 Signal path 95422 Absolute addressing of tags 96423 Symbolic addressing of tags 101424 Addressing constants 102

43 Indirect addressing 103431 Memory-indirect addressing with STL 104432 Register-indirect addressing with STL 106433 Working with the address registers with STL 108434 Direct access to complex local tags with STL 115435 Indirect addressing with SCL 117

44 Elementary data types 119441 Introduction 119442 Bit-serial data types BOOL BYTE WORD and DWORD 122443 BCD numbers BCD16 and BCD32 122444 Fixed-point data types with sign INT and DINT 122445 Floating-point data type REAL 124446 Data type CHAR 125447 Data types for durations and points in time 126

45 Complex data types 127451 STRING data type 128452 Data type ARRAY 129453 Data type STRUCT 131

Table of contents

10

46 Parameter types and pointers 133461 Parameter types 133462 Pointer 135463 ldquoVariablerdquo ANY pointer with STL 138464 ldquoVariablerdquo ANY pointer with SCL 138

47 PLC data types 14148 Start information 141

5 Program execution 14351 Operating states of the CPU 143

511 STOP operating state 144512 STARTUP operating state 145513 RUN operating state 149514 HOLD operating state 149515 Reset CPU memory 149516 Restoring the factory settings 150517 Retentive behavior of operands 151

52 Creating a user program 151521 Program draft 151522 Program execution 155523 Block types 156524 Editing block properties 158525 Block interface 162526 Example of use of block parameters 163

53 Calling blocks 165531 General information on calling of code blocks 165532 Calling functions (FC) 165533 Calling function blocks (FB) 167534 ldquoPassing onrdquo of block parameters 170

54 Startup program 171541 Startup organization blocks OB 100 OB 101 and OB 102 171542 Determining a module address 172543 Parameterization of modules 173

55 Main program 177551 Organization block OB 1 177552 Process image 177553 Cycle time and response time 182554 Minimum cycle time and background processing 184555 Compress hold stop and protect program 186556 Time 187557 Determine system time and OB runtime 191558 Runtime meter 195

56 Interrupt processing 196561 Introduction to interrupt processing 196562 Priority classes 197563 Time-of-day interrupts organization blocks OB 10 to OB 17 199564 Time-delay interrupts organization blocks OB 20 to OB 23 202565 Cyclic interrupts organization blocks OB 30 to OB 38 205566 Hardware interrupts organization blocks OB 40 to OB 47 207567 Interrupts for DPV1 organization blocks OB 55 to OB 57 208568 Synchronous cycle interrupts organization blocks OB 61 to OB 64 209

Table of contents

11

569 Reading additional interrupt information 21257 Error handling 213

571 Causes of errors and error responses 213572 Synchronous error 213573 Enabling and disabling synchronous error processing 215574 Enter substitute value 218575 Asynchronous errors 218576 Disable delay and enable interrupts and asynchronous errors 224

58 Diagnostics 226581 Diagnostics interrupt organization block OB 82 226582 Read system state list 227583 Read start information 228584 Determine connection status 229585 System diagnostics with Report System Errors 231

59 Configure alarms 233591 Introduction 233592 Configuring alarms according to the message numbering 236593 Message blocks for PLC alarms with instance data 241594 Message blocks for PLC alarms without instance data 244595 Blocks for working with alarms 246596 Configuring a user diagnostic alarm 249597 CPU alarm display 250

6 Program editor 25361 Introduction 25362 PLC tag table 254

621 Editing PLC tag tables 254622 Defining PLC tags 254623 Exporting and importing a PLC tag table 256624 Constants tables 257

63 Programming a code block 257631 Creating a new code block 257632 Working area of program editor for code blocks 258633 Specifying code block properties 260634 Programming a block interface 260635 Programming a control function 262636 Editing tags 266637 Working with program comments 268

64 Programming a data block 270641 Creating a new data block 270642 Working area of program editor for data blocks 270643 Defining properties for data blocks 271644 Declaring data tags 272645 Entering data tags in global data blocks 273

65 Compiling blocks 273651 Starting the compilation 273652 Compiling SCL blocks 274653 Eliminating errors following compilation 275

66 Program information 276661 Cross-reference list 276662 Assignment list 278

Table of contents

12

663 Call structure 279664 Dependency structure 280665 Consistency check 281666 Memory utilization of the CPU 281

7 Ladder logic LAD 28371 Introduction 283

711 Programming with LAD in general 283712 Program elements of ladder logic 285

72 Programming binary logic operations with LAD 286721 NO and NC contacts 286722 Series and parallel connection of contacts 287723 T branch open parallel branch 288724 Negating result of logic operation 289725 Edge evaluation of a binary tag 289726 Comparison contacts 290

73 Programming memory functions with LAD 290731 Simple coil assignment 291732 Set and reset coils 292733 Retentive response due to latching 292734 Coils with time response 293735 Coils with counter response 294

74 Programming Q boxes with LAD 295741 Memory boxes 296742 Edge evaluation of current flow 296743 SIMATIC timer functions 297744 SIMATIC counter functions 298745 IEC timer functions 299746 IEC counter functions 300

75 Programming ENENO boxes with LAD 301751 Transfer function MOVE 302752 Arithmetic functions 302753 Math functions 303754 Conversion functions 304755 Shift functions 305756 Word logic operations 306

76 Controlling the program flow with LAD 307761 Working with status bits in the ladder logic 307762 ENENO mechanism with LAD 309763 Jump functions 310764 Block functions 311765 Master Control Relay (MCR) 313

8 Function block diagram FBD 31581 Introduction 315

811 Programming with FBD in general 315812 Program elements of the function block diagram 317

82 Programming binary logic operations with FBD 318821 Scanning for signal states ldquo1rdquo and ldquo0rdquo 318822 Programming a binary logic operation in the function block diagram 319

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 6: cover - cdn1.ozone.ru

The contents of the book at a glance

6

The contents of the book at a glance

Start

Overview of the SIMATIC S7-400 automation system

Introduction to the SIMATIC STEP 7 Professional V11 engineering software

The basis of the automation solution Creating and editing a project

SIMATIC S7-400 automation system

Overview of SIMATIC S7-400 modules Design of an automation system CPUs signal func-tion 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 IO 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 module 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 ENENO 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 ENENO 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

The contents of the book at a glance

7

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 testing

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 IO

Overview The ET 200 distributed IO 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

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

How PtP communication is implemented

Annex

How external source files are created and imported for STL and SCL blocks

How a project created using STEP 7 V5x 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

Table of contents

8

Table of contents

1 Introduction 2111 Overview of the S7-400 automation system 21

111 SIMATIC S7-400 programmable controller 22112 Overview of STEP 7 Professional V11 23113 Five programming languages 25114 Execution of the user program 27115 Data management in the SIMATIC automation system 30

12 Introduction to STEP 7 Professional V11 30121 Installing STEP 7 30122 Automation License Manager 31123 Starting STEP 7 Professional 31124 Portal view 31125 Help information system 33126 The windows of the Project view 33127 Adapting the user interface 36

13 Editing a SIMATIC project 36131 Structured representation of project data 37132 Project data and editors for a PLC station 37133 Creating and editing a project 41134 Creating and editing libraries 43

2 SIMATIC S7-400 automation system 4421 Components of an S7-400 station 4422 S7-400 CPUs 48

221 CPU versions 48222 Control and display elements 50223 SIMATIC memory card 51224 Memory areas in an S7-400 station 51225 Bus interfaces 53226 IF 964-DP interface module 54

23 Signal modules 54231 Digital input modules 54232 Digital output modules 55233 Analog input modules 56234 Analog output module 57

24 Function modules 5725 Communication modules 5826 Other modules 59

261 Interface modules 59262 Power supply modules 60

27 SIPLUS S7-400 61

Table of contents

9

3 Device configuration 6231 Introduction 6232 Configuring a station 65

321 Adding a PLC station 65322 Adding a module 65323 Adding an expansion unit 66

33 Parameterization of modules 67331 Parameterization of CPU properties 67332 Addressing modules 70333 Assigning parameters to signal modules 73

34 Configuring the network 74341 Introduction overview 74342 Networking stations 75343 Node addresses in a subnet 76344 Connections 77345 Configuring an MPI subnet 80346 Configuring a PROFIBUS subnet 81347 Configuring a PROFINET subnet 82348 Configuring a PtP subnet 86

4 Tags addressing and data types 8941 Operands and tags 89

411 Introduction overview 89412 Operand areas inputs and outputs 90413 Operand area bit memory 92414 Operand area data 93415 Operand area temporary local data 94

42 Addressing of operands and tags 95421 Signal path 95422 Absolute addressing of tags 96423 Symbolic addressing of tags 101424 Addressing constants 102

43 Indirect addressing 103431 Memory-indirect addressing with STL 104432 Register-indirect addressing with STL 106433 Working with the address registers with STL 108434 Direct access to complex local tags with STL 115435 Indirect addressing with SCL 117

44 Elementary data types 119441 Introduction 119442 Bit-serial data types BOOL BYTE WORD and DWORD 122443 BCD numbers BCD16 and BCD32 122444 Fixed-point data types with sign INT and DINT 122445 Floating-point data type REAL 124446 Data type CHAR 125447 Data types for durations and points in time 126

45 Complex data types 127451 STRING data type 128452 Data type ARRAY 129453 Data type STRUCT 131

Table of contents

10

46 Parameter types and pointers 133461 Parameter types 133462 Pointer 135463 ldquoVariablerdquo ANY pointer with STL 138464 ldquoVariablerdquo ANY pointer with SCL 138

47 PLC data types 14148 Start information 141

5 Program execution 14351 Operating states of the CPU 143

511 STOP operating state 144512 STARTUP operating state 145513 RUN operating state 149514 HOLD operating state 149515 Reset CPU memory 149516 Restoring the factory settings 150517 Retentive behavior of operands 151

52 Creating a user program 151521 Program draft 151522 Program execution 155523 Block types 156524 Editing block properties 158525 Block interface 162526 Example of use of block parameters 163

53 Calling blocks 165531 General information on calling of code blocks 165532 Calling functions (FC) 165533 Calling function blocks (FB) 167534 ldquoPassing onrdquo of block parameters 170

54 Startup program 171541 Startup organization blocks OB 100 OB 101 and OB 102 171542 Determining a module address 172543 Parameterization of modules 173

55 Main program 177551 Organization block OB 1 177552 Process image 177553 Cycle time and response time 182554 Minimum cycle time and background processing 184555 Compress hold stop and protect program 186556 Time 187557 Determine system time and OB runtime 191558 Runtime meter 195

56 Interrupt processing 196561 Introduction to interrupt processing 196562 Priority classes 197563 Time-of-day interrupts organization blocks OB 10 to OB 17 199564 Time-delay interrupts organization blocks OB 20 to OB 23 202565 Cyclic interrupts organization blocks OB 30 to OB 38 205566 Hardware interrupts organization blocks OB 40 to OB 47 207567 Interrupts for DPV1 organization blocks OB 55 to OB 57 208568 Synchronous cycle interrupts organization blocks OB 61 to OB 64 209

Table of contents

11

569 Reading additional interrupt information 21257 Error handling 213

571 Causes of errors and error responses 213572 Synchronous error 213573 Enabling and disabling synchronous error processing 215574 Enter substitute value 218575 Asynchronous errors 218576 Disable delay and enable interrupts and asynchronous errors 224

58 Diagnostics 226581 Diagnostics interrupt organization block OB 82 226582 Read system state list 227583 Read start information 228584 Determine connection status 229585 System diagnostics with Report System Errors 231

59 Configure alarms 233591 Introduction 233592 Configuring alarms according to the message numbering 236593 Message blocks for PLC alarms with instance data 241594 Message blocks for PLC alarms without instance data 244595 Blocks for working with alarms 246596 Configuring a user diagnostic alarm 249597 CPU alarm display 250

6 Program editor 25361 Introduction 25362 PLC tag table 254

621 Editing PLC tag tables 254622 Defining PLC tags 254623 Exporting and importing a PLC tag table 256624 Constants tables 257

63 Programming a code block 257631 Creating a new code block 257632 Working area of program editor for code blocks 258633 Specifying code block properties 260634 Programming a block interface 260635 Programming a control function 262636 Editing tags 266637 Working with program comments 268

64 Programming a data block 270641 Creating a new data block 270642 Working area of program editor for data blocks 270643 Defining properties for data blocks 271644 Declaring data tags 272645 Entering data tags in global data blocks 273

65 Compiling blocks 273651 Starting the compilation 273652 Compiling SCL blocks 274653 Eliminating errors following compilation 275

66 Program information 276661 Cross-reference list 276662 Assignment list 278

Table of contents

12

663 Call structure 279664 Dependency structure 280665 Consistency check 281666 Memory utilization of the CPU 281

7 Ladder logic LAD 28371 Introduction 283

711 Programming with LAD in general 283712 Program elements of ladder logic 285

72 Programming binary logic operations with LAD 286721 NO and NC contacts 286722 Series and parallel connection of contacts 287723 T branch open parallel branch 288724 Negating result of logic operation 289725 Edge evaluation of a binary tag 289726 Comparison contacts 290

73 Programming memory functions with LAD 290731 Simple coil assignment 291732 Set and reset coils 292733 Retentive response due to latching 292734 Coils with time response 293735 Coils with counter response 294

74 Programming Q boxes with LAD 295741 Memory boxes 296742 Edge evaluation of current flow 296743 SIMATIC timer functions 297744 SIMATIC counter functions 298745 IEC timer functions 299746 IEC counter functions 300

75 Programming ENENO boxes with LAD 301751 Transfer function MOVE 302752 Arithmetic functions 302753 Math functions 303754 Conversion functions 304755 Shift functions 305756 Word logic operations 306

76 Controlling the program flow with LAD 307761 Working with status bits in the ladder logic 307762 ENENO mechanism with LAD 309763 Jump functions 310764 Block functions 311765 Master Control Relay (MCR) 313

8 Function block diagram FBD 31581 Introduction 315

811 Programming with FBD in general 315812 Program elements of the function block diagram 317

82 Programming binary logic operations with FBD 318821 Scanning for signal states ldquo1rdquo and ldquo0rdquo 318822 Programming a binary logic operation in the function block diagram 319

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 7: cover - cdn1.ozone.ru

The contents of the book at a glance

7

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 testing

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 IO

Overview The ET 200 distributed IO 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

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

How PtP communication is implemented

Annex

How external source files are created and imported for STL and SCL blocks

How a project created using STEP 7 V5x 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

Table of contents

8

Table of contents

1 Introduction 2111 Overview of the S7-400 automation system 21

111 SIMATIC S7-400 programmable controller 22112 Overview of STEP 7 Professional V11 23113 Five programming languages 25114 Execution of the user program 27115 Data management in the SIMATIC automation system 30

12 Introduction to STEP 7 Professional V11 30121 Installing STEP 7 30122 Automation License Manager 31123 Starting STEP 7 Professional 31124 Portal view 31125 Help information system 33126 The windows of the Project view 33127 Adapting the user interface 36

13 Editing a SIMATIC project 36131 Structured representation of project data 37132 Project data and editors for a PLC station 37133 Creating and editing a project 41134 Creating and editing libraries 43

2 SIMATIC S7-400 automation system 4421 Components of an S7-400 station 4422 S7-400 CPUs 48

221 CPU versions 48222 Control and display elements 50223 SIMATIC memory card 51224 Memory areas in an S7-400 station 51225 Bus interfaces 53226 IF 964-DP interface module 54

23 Signal modules 54231 Digital input modules 54232 Digital output modules 55233 Analog input modules 56234 Analog output module 57

24 Function modules 5725 Communication modules 5826 Other modules 59

261 Interface modules 59262 Power supply modules 60

27 SIPLUS S7-400 61

Table of contents

9

3 Device configuration 6231 Introduction 6232 Configuring a station 65

321 Adding a PLC station 65322 Adding a module 65323 Adding an expansion unit 66

33 Parameterization of modules 67331 Parameterization of CPU properties 67332 Addressing modules 70333 Assigning parameters to signal modules 73

34 Configuring the network 74341 Introduction overview 74342 Networking stations 75343 Node addresses in a subnet 76344 Connections 77345 Configuring an MPI subnet 80346 Configuring a PROFIBUS subnet 81347 Configuring a PROFINET subnet 82348 Configuring a PtP subnet 86

4 Tags addressing and data types 8941 Operands and tags 89

411 Introduction overview 89412 Operand areas inputs and outputs 90413 Operand area bit memory 92414 Operand area data 93415 Operand area temporary local data 94

42 Addressing of operands and tags 95421 Signal path 95422 Absolute addressing of tags 96423 Symbolic addressing of tags 101424 Addressing constants 102

43 Indirect addressing 103431 Memory-indirect addressing with STL 104432 Register-indirect addressing with STL 106433 Working with the address registers with STL 108434 Direct access to complex local tags with STL 115435 Indirect addressing with SCL 117

44 Elementary data types 119441 Introduction 119442 Bit-serial data types BOOL BYTE WORD and DWORD 122443 BCD numbers BCD16 and BCD32 122444 Fixed-point data types with sign INT and DINT 122445 Floating-point data type REAL 124446 Data type CHAR 125447 Data types for durations and points in time 126

45 Complex data types 127451 STRING data type 128452 Data type ARRAY 129453 Data type STRUCT 131

Table of contents

10

46 Parameter types and pointers 133461 Parameter types 133462 Pointer 135463 ldquoVariablerdquo ANY pointer with STL 138464 ldquoVariablerdquo ANY pointer with SCL 138

47 PLC data types 14148 Start information 141

5 Program execution 14351 Operating states of the CPU 143

511 STOP operating state 144512 STARTUP operating state 145513 RUN operating state 149514 HOLD operating state 149515 Reset CPU memory 149516 Restoring the factory settings 150517 Retentive behavior of operands 151

52 Creating a user program 151521 Program draft 151522 Program execution 155523 Block types 156524 Editing block properties 158525 Block interface 162526 Example of use of block parameters 163

53 Calling blocks 165531 General information on calling of code blocks 165532 Calling functions (FC) 165533 Calling function blocks (FB) 167534 ldquoPassing onrdquo of block parameters 170

54 Startup program 171541 Startup organization blocks OB 100 OB 101 and OB 102 171542 Determining a module address 172543 Parameterization of modules 173

55 Main program 177551 Organization block OB 1 177552 Process image 177553 Cycle time and response time 182554 Minimum cycle time and background processing 184555 Compress hold stop and protect program 186556 Time 187557 Determine system time and OB runtime 191558 Runtime meter 195

56 Interrupt processing 196561 Introduction to interrupt processing 196562 Priority classes 197563 Time-of-day interrupts organization blocks OB 10 to OB 17 199564 Time-delay interrupts organization blocks OB 20 to OB 23 202565 Cyclic interrupts organization blocks OB 30 to OB 38 205566 Hardware interrupts organization blocks OB 40 to OB 47 207567 Interrupts for DPV1 organization blocks OB 55 to OB 57 208568 Synchronous cycle interrupts organization blocks OB 61 to OB 64 209

Table of contents

11

569 Reading additional interrupt information 21257 Error handling 213

571 Causes of errors and error responses 213572 Synchronous error 213573 Enabling and disabling synchronous error processing 215574 Enter substitute value 218575 Asynchronous errors 218576 Disable delay and enable interrupts and asynchronous errors 224

58 Diagnostics 226581 Diagnostics interrupt organization block OB 82 226582 Read system state list 227583 Read start information 228584 Determine connection status 229585 System diagnostics with Report System Errors 231

59 Configure alarms 233591 Introduction 233592 Configuring alarms according to the message numbering 236593 Message blocks for PLC alarms with instance data 241594 Message blocks for PLC alarms without instance data 244595 Blocks for working with alarms 246596 Configuring a user diagnostic alarm 249597 CPU alarm display 250

6 Program editor 25361 Introduction 25362 PLC tag table 254

621 Editing PLC tag tables 254622 Defining PLC tags 254623 Exporting and importing a PLC tag table 256624 Constants tables 257

63 Programming a code block 257631 Creating a new code block 257632 Working area of program editor for code blocks 258633 Specifying code block properties 260634 Programming a block interface 260635 Programming a control function 262636 Editing tags 266637 Working with program comments 268

64 Programming a data block 270641 Creating a new data block 270642 Working area of program editor for data blocks 270643 Defining properties for data blocks 271644 Declaring data tags 272645 Entering data tags in global data blocks 273

65 Compiling blocks 273651 Starting the compilation 273652 Compiling SCL blocks 274653 Eliminating errors following compilation 275

66 Program information 276661 Cross-reference list 276662 Assignment list 278

Table of contents

12

663 Call structure 279664 Dependency structure 280665 Consistency check 281666 Memory utilization of the CPU 281

7 Ladder logic LAD 28371 Introduction 283

711 Programming with LAD in general 283712 Program elements of ladder logic 285

72 Programming binary logic operations with LAD 286721 NO and NC contacts 286722 Series and parallel connection of contacts 287723 T branch open parallel branch 288724 Negating result of logic operation 289725 Edge evaluation of a binary tag 289726 Comparison contacts 290

73 Programming memory functions with LAD 290731 Simple coil assignment 291732 Set and reset coils 292733 Retentive response due to latching 292734 Coils with time response 293735 Coils with counter response 294

74 Programming Q boxes with LAD 295741 Memory boxes 296742 Edge evaluation of current flow 296743 SIMATIC timer functions 297744 SIMATIC counter functions 298745 IEC timer functions 299746 IEC counter functions 300

75 Programming ENENO boxes with LAD 301751 Transfer function MOVE 302752 Arithmetic functions 302753 Math functions 303754 Conversion functions 304755 Shift functions 305756 Word logic operations 306

76 Controlling the program flow with LAD 307761 Working with status bits in the ladder logic 307762 ENENO mechanism with LAD 309763 Jump functions 310764 Block functions 311765 Master Control Relay (MCR) 313

8 Function block diagram FBD 31581 Introduction 315

811 Programming with FBD in general 315812 Program elements of the function block diagram 317

82 Programming binary logic operations with FBD 318821 Scanning for signal states ldquo1rdquo and ldquo0rdquo 318822 Programming a binary logic operation in the function block diagram 319

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 8: cover - cdn1.ozone.ru

Table of contents

8

Table of contents

1 Introduction 2111 Overview of the S7-400 automation system 21

111 SIMATIC S7-400 programmable controller 22112 Overview of STEP 7 Professional V11 23113 Five programming languages 25114 Execution of the user program 27115 Data management in the SIMATIC automation system 30

12 Introduction to STEP 7 Professional V11 30121 Installing STEP 7 30122 Automation License Manager 31123 Starting STEP 7 Professional 31124 Portal view 31125 Help information system 33126 The windows of the Project view 33127 Adapting the user interface 36

13 Editing a SIMATIC project 36131 Structured representation of project data 37132 Project data and editors for a PLC station 37133 Creating and editing a project 41134 Creating and editing libraries 43

2 SIMATIC S7-400 automation system 4421 Components of an S7-400 station 4422 S7-400 CPUs 48

221 CPU versions 48222 Control and display elements 50223 SIMATIC memory card 51224 Memory areas in an S7-400 station 51225 Bus interfaces 53226 IF 964-DP interface module 54

23 Signal modules 54231 Digital input modules 54232 Digital output modules 55233 Analog input modules 56234 Analog output module 57

24 Function modules 5725 Communication modules 5826 Other modules 59

261 Interface modules 59262 Power supply modules 60

27 SIPLUS S7-400 61

Table of contents

9

3 Device configuration 6231 Introduction 6232 Configuring a station 65

321 Adding a PLC station 65322 Adding a module 65323 Adding an expansion unit 66

33 Parameterization of modules 67331 Parameterization of CPU properties 67332 Addressing modules 70333 Assigning parameters to signal modules 73

34 Configuring the network 74341 Introduction overview 74342 Networking stations 75343 Node addresses in a subnet 76344 Connections 77345 Configuring an MPI subnet 80346 Configuring a PROFIBUS subnet 81347 Configuring a PROFINET subnet 82348 Configuring a PtP subnet 86

4 Tags addressing and data types 8941 Operands and tags 89

411 Introduction overview 89412 Operand areas inputs and outputs 90413 Operand area bit memory 92414 Operand area data 93415 Operand area temporary local data 94

42 Addressing of operands and tags 95421 Signal path 95422 Absolute addressing of tags 96423 Symbolic addressing of tags 101424 Addressing constants 102

43 Indirect addressing 103431 Memory-indirect addressing with STL 104432 Register-indirect addressing with STL 106433 Working with the address registers with STL 108434 Direct access to complex local tags with STL 115435 Indirect addressing with SCL 117

44 Elementary data types 119441 Introduction 119442 Bit-serial data types BOOL BYTE WORD and DWORD 122443 BCD numbers BCD16 and BCD32 122444 Fixed-point data types with sign INT and DINT 122445 Floating-point data type REAL 124446 Data type CHAR 125447 Data types for durations and points in time 126

45 Complex data types 127451 STRING data type 128452 Data type ARRAY 129453 Data type STRUCT 131

Table of contents

10

46 Parameter types and pointers 133461 Parameter types 133462 Pointer 135463 ldquoVariablerdquo ANY pointer with STL 138464 ldquoVariablerdquo ANY pointer with SCL 138

47 PLC data types 14148 Start information 141

5 Program execution 14351 Operating states of the CPU 143

511 STOP operating state 144512 STARTUP operating state 145513 RUN operating state 149514 HOLD operating state 149515 Reset CPU memory 149516 Restoring the factory settings 150517 Retentive behavior of operands 151

52 Creating a user program 151521 Program draft 151522 Program execution 155523 Block types 156524 Editing block properties 158525 Block interface 162526 Example of use of block parameters 163

53 Calling blocks 165531 General information on calling of code blocks 165532 Calling functions (FC) 165533 Calling function blocks (FB) 167534 ldquoPassing onrdquo of block parameters 170

54 Startup program 171541 Startup organization blocks OB 100 OB 101 and OB 102 171542 Determining a module address 172543 Parameterization of modules 173

55 Main program 177551 Organization block OB 1 177552 Process image 177553 Cycle time and response time 182554 Minimum cycle time and background processing 184555 Compress hold stop and protect program 186556 Time 187557 Determine system time and OB runtime 191558 Runtime meter 195

56 Interrupt processing 196561 Introduction to interrupt processing 196562 Priority classes 197563 Time-of-day interrupts organization blocks OB 10 to OB 17 199564 Time-delay interrupts organization blocks OB 20 to OB 23 202565 Cyclic interrupts organization blocks OB 30 to OB 38 205566 Hardware interrupts organization blocks OB 40 to OB 47 207567 Interrupts for DPV1 organization blocks OB 55 to OB 57 208568 Synchronous cycle interrupts organization blocks OB 61 to OB 64 209

Table of contents

11

569 Reading additional interrupt information 21257 Error handling 213

571 Causes of errors and error responses 213572 Synchronous error 213573 Enabling and disabling synchronous error processing 215574 Enter substitute value 218575 Asynchronous errors 218576 Disable delay and enable interrupts and asynchronous errors 224

58 Diagnostics 226581 Diagnostics interrupt organization block OB 82 226582 Read system state list 227583 Read start information 228584 Determine connection status 229585 System diagnostics with Report System Errors 231

59 Configure alarms 233591 Introduction 233592 Configuring alarms according to the message numbering 236593 Message blocks for PLC alarms with instance data 241594 Message blocks for PLC alarms without instance data 244595 Blocks for working with alarms 246596 Configuring a user diagnostic alarm 249597 CPU alarm display 250

6 Program editor 25361 Introduction 25362 PLC tag table 254

621 Editing PLC tag tables 254622 Defining PLC tags 254623 Exporting and importing a PLC tag table 256624 Constants tables 257

63 Programming a code block 257631 Creating a new code block 257632 Working area of program editor for code blocks 258633 Specifying code block properties 260634 Programming a block interface 260635 Programming a control function 262636 Editing tags 266637 Working with program comments 268

64 Programming a data block 270641 Creating a new data block 270642 Working area of program editor for data blocks 270643 Defining properties for data blocks 271644 Declaring data tags 272645 Entering data tags in global data blocks 273

65 Compiling blocks 273651 Starting the compilation 273652 Compiling SCL blocks 274653 Eliminating errors following compilation 275

66 Program information 276661 Cross-reference list 276662 Assignment list 278

Table of contents

12

663 Call structure 279664 Dependency structure 280665 Consistency check 281666 Memory utilization of the CPU 281

7 Ladder logic LAD 28371 Introduction 283

711 Programming with LAD in general 283712 Program elements of ladder logic 285

72 Programming binary logic operations with LAD 286721 NO and NC contacts 286722 Series and parallel connection of contacts 287723 T branch open parallel branch 288724 Negating result of logic operation 289725 Edge evaluation of a binary tag 289726 Comparison contacts 290

73 Programming memory functions with LAD 290731 Simple coil assignment 291732 Set and reset coils 292733 Retentive response due to latching 292734 Coils with time response 293735 Coils with counter response 294

74 Programming Q boxes with LAD 295741 Memory boxes 296742 Edge evaluation of current flow 296743 SIMATIC timer functions 297744 SIMATIC counter functions 298745 IEC timer functions 299746 IEC counter functions 300

75 Programming ENENO boxes with LAD 301751 Transfer function MOVE 302752 Arithmetic functions 302753 Math functions 303754 Conversion functions 304755 Shift functions 305756 Word logic operations 306

76 Controlling the program flow with LAD 307761 Working with status bits in the ladder logic 307762 ENENO mechanism with LAD 309763 Jump functions 310764 Block functions 311765 Master Control Relay (MCR) 313

8 Function block diagram FBD 31581 Introduction 315

811 Programming with FBD in general 315812 Program elements of the function block diagram 317

82 Programming binary logic operations with FBD 318821 Scanning for signal states ldquo1rdquo and ldquo0rdquo 318822 Programming a binary logic operation in the function block diagram 319

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 9: cover - cdn1.ozone.ru

Table of contents

9

3 Device configuration 6231 Introduction 6232 Configuring a station 65

321 Adding a PLC station 65322 Adding a module 65323 Adding an expansion unit 66

33 Parameterization of modules 67331 Parameterization of CPU properties 67332 Addressing modules 70333 Assigning parameters to signal modules 73

34 Configuring the network 74341 Introduction overview 74342 Networking stations 75343 Node addresses in a subnet 76344 Connections 77345 Configuring an MPI subnet 80346 Configuring a PROFIBUS subnet 81347 Configuring a PROFINET subnet 82348 Configuring a PtP subnet 86

4 Tags addressing and data types 8941 Operands and tags 89

411 Introduction overview 89412 Operand areas inputs and outputs 90413 Operand area bit memory 92414 Operand area data 93415 Operand area temporary local data 94

42 Addressing of operands and tags 95421 Signal path 95422 Absolute addressing of tags 96423 Symbolic addressing of tags 101424 Addressing constants 102

43 Indirect addressing 103431 Memory-indirect addressing with STL 104432 Register-indirect addressing with STL 106433 Working with the address registers with STL 108434 Direct access to complex local tags with STL 115435 Indirect addressing with SCL 117

44 Elementary data types 119441 Introduction 119442 Bit-serial data types BOOL BYTE WORD and DWORD 122443 BCD numbers BCD16 and BCD32 122444 Fixed-point data types with sign INT and DINT 122445 Floating-point data type REAL 124446 Data type CHAR 125447 Data types for durations and points in time 126

45 Complex data types 127451 STRING data type 128452 Data type ARRAY 129453 Data type STRUCT 131

Table of contents

10

46 Parameter types and pointers 133461 Parameter types 133462 Pointer 135463 ldquoVariablerdquo ANY pointer with STL 138464 ldquoVariablerdquo ANY pointer with SCL 138

47 PLC data types 14148 Start information 141

5 Program execution 14351 Operating states of the CPU 143

511 STOP operating state 144512 STARTUP operating state 145513 RUN operating state 149514 HOLD operating state 149515 Reset CPU memory 149516 Restoring the factory settings 150517 Retentive behavior of operands 151

52 Creating a user program 151521 Program draft 151522 Program execution 155523 Block types 156524 Editing block properties 158525 Block interface 162526 Example of use of block parameters 163

53 Calling blocks 165531 General information on calling of code blocks 165532 Calling functions (FC) 165533 Calling function blocks (FB) 167534 ldquoPassing onrdquo of block parameters 170

54 Startup program 171541 Startup organization blocks OB 100 OB 101 and OB 102 171542 Determining a module address 172543 Parameterization of modules 173

55 Main program 177551 Organization block OB 1 177552 Process image 177553 Cycle time and response time 182554 Minimum cycle time and background processing 184555 Compress hold stop and protect program 186556 Time 187557 Determine system time and OB runtime 191558 Runtime meter 195

56 Interrupt processing 196561 Introduction to interrupt processing 196562 Priority classes 197563 Time-of-day interrupts organization blocks OB 10 to OB 17 199564 Time-delay interrupts organization blocks OB 20 to OB 23 202565 Cyclic interrupts organization blocks OB 30 to OB 38 205566 Hardware interrupts organization blocks OB 40 to OB 47 207567 Interrupts for DPV1 organization blocks OB 55 to OB 57 208568 Synchronous cycle interrupts organization blocks OB 61 to OB 64 209

Table of contents

11

569 Reading additional interrupt information 21257 Error handling 213

571 Causes of errors and error responses 213572 Synchronous error 213573 Enabling and disabling synchronous error processing 215574 Enter substitute value 218575 Asynchronous errors 218576 Disable delay and enable interrupts and asynchronous errors 224

58 Diagnostics 226581 Diagnostics interrupt organization block OB 82 226582 Read system state list 227583 Read start information 228584 Determine connection status 229585 System diagnostics with Report System Errors 231

59 Configure alarms 233591 Introduction 233592 Configuring alarms according to the message numbering 236593 Message blocks for PLC alarms with instance data 241594 Message blocks for PLC alarms without instance data 244595 Blocks for working with alarms 246596 Configuring a user diagnostic alarm 249597 CPU alarm display 250

6 Program editor 25361 Introduction 25362 PLC tag table 254

621 Editing PLC tag tables 254622 Defining PLC tags 254623 Exporting and importing a PLC tag table 256624 Constants tables 257

63 Programming a code block 257631 Creating a new code block 257632 Working area of program editor for code blocks 258633 Specifying code block properties 260634 Programming a block interface 260635 Programming a control function 262636 Editing tags 266637 Working with program comments 268

64 Programming a data block 270641 Creating a new data block 270642 Working area of program editor for data blocks 270643 Defining properties for data blocks 271644 Declaring data tags 272645 Entering data tags in global data blocks 273

65 Compiling blocks 273651 Starting the compilation 273652 Compiling SCL blocks 274653 Eliminating errors following compilation 275

66 Program information 276661 Cross-reference list 276662 Assignment list 278

Table of contents

12

663 Call structure 279664 Dependency structure 280665 Consistency check 281666 Memory utilization of the CPU 281

7 Ladder logic LAD 28371 Introduction 283

711 Programming with LAD in general 283712 Program elements of ladder logic 285

72 Programming binary logic operations with LAD 286721 NO and NC contacts 286722 Series and parallel connection of contacts 287723 T branch open parallel branch 288724 Negating result of logic operation 289725 Edge evaluation of a binary tag 289726 Comparison contacts 290

73 Programming memory functions with LAD 290731 Simple coil assignment 291732 Set and reset coils 292733 Retentive response due to latching 292734 Coils with time response 293735 Coils with counter response 294

74 Programming Q boxes with LAD 295741 Memory boxes 296742 Edge evaluation of current flow 296743 SIMATIC timer functions 297744 SIMATIC counter functions 298745 IEC timer functions 299746 IEC counter functions 300

75 Programming ENENO boxes with LAD 301751 Transfer function MOVE 302752 Arithmetic functions 302753 Math functions 303754 Conversion functions 304755 Shift functions 305756 Word logic operations 306

76 Controlling the program flow with LAD 307761 Working with status bits in the ladder logic 307762 ENENO mechanism with LAD 309763 Jump functions 310764 Block functions 311765 Master Control Relay (MCR) 313

8 Function block diagram FBD 31581 Introduction 315

811 Programming with FBD in general 315812 Program elements of the function block diagram 317

82 Programming binary logic operations with FBD 318821 Scanning for signal states ldquo1rdquo and ldquo0rdquo 318822 Programming a binary logic operation in the function block diagram 319

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 10: cover - cdn1.ozone.ru

Table of contents

10

46 Parameter types and pointers 133461 Parameter types 133462 Pointer 135463 ldquoVariablerdquo ANY pointer with STL 138464 ldquoVariablerdquo ANY pointer with SCL 138

47 PLC data types 14148 Start information 141

5 Program execution 14351 Operating states of the CPU 143

511 STOP operating state 144512 STARTUP operating state 145513 RUN operating state 149514 HOLD operating state 149515 Reset CPU memory 149516 Restoring the factory settings 150517 Retentive behavior of operands 151

52 Creating a user program 151521 Program draft 151522 Program execution 155523 Block types 156524 Editing block properties 158525 Block interface 162526 Example of use of block parameters 163

53 Calling blocks 165531 General information on calling of code blocks 165532 Calling functions (FC) 165533 Calling function blocks (FB) 167534 ldquoPassing onrdquo of block parameters 170

54 Startup program 171541 Startup organization blocks OB 100 OB 101 and OB 102 171542 Determining a module address 172543 Parameterization of modules 173

55 Main program 177551 Organization block OB 1 177552 Process image 177553 Cycle time and response time 182554 Minimum cycle time and background processing 184555 Compress hold stop and protect program 186556 Time 187557 Determine system time and OB runtime 191558 Runtime meter 195

56 Interrupt processing 196561 Introduction to interrupt processing 196562 Priority classes 197563 Time-of-day interrupts organization blocks OB 10 to OB 17 199564 Time-delay interrupts organization blocks OB 20 to OB 23 202565 Cyclic interrupts organization blocks OB 30 to OB 38 205566 Hardware interrupts organization blocks OB 40 to OB 47 207567 Interrupts for DPV1 organization blocks OB 55 to OB 57 208568 Synchronous cycle interrupts organization blocks OB 61 to OB 64 209

Table of contents

11

569 Reading additional interrupt information 21257 Error handling 213

571 Causes of errors and error responses 213572 Synchronous error 213573 Enabling and disabling synchronous error processing 215574 Enter substitute value 218575 Asynchronous errors 218576 Disable delay and enable interrupts and asynchronous errors 224

58 Diagnostics 226581 Diagnostics interrupt organization block OB 82 226582 Read system state list 227583 Read start information 228584 Determine connection status 229585 System diagnostics with Report System Errors 231

59 Configure alarms 233591 Introduction 233592 Configuring alarms according to the message numbering 236593 Message blocks for PLC alarms with instance data 241594 Message blocks for PLC alarms without instance data 244595 Blocks for working with alarms 246596 Configuring a user diagnostic alarm 249597 CPU alarm display 250

6 Program editor 25361 Introduction 25362 PLC tag table 254

621 Editing PLC tag tables 254622 Defining PLC tags 254623 Exporting and importing a PLC tag table 256624 Constants tables 257

63 Programming a code block 257631 Creating a new code block 257632 Working area of program editor for code blocks 258633 Specifying code block properties 260634 Programming a block interface 260635 Programming a control function 262636 Editing tags 266637 Working with program comments 268

64 Programming a data block 270641 Creating a new data block 270642 Working area of program editor for data blocks 270643 Defining properties for data blocks 271644 Declaring data tags 272645 Entering data tags in global data blocks 273

65 Compiling blocks 273651 Starting the compilation 273652 Compiling SCL blocks 274653 Eliminating errors following compilation 275

66 Program information 276661 Cross-reference list 276662 Assignment list 278

Table of contents

12

663 Call structure 279664 Dependency structure 280665 Consistency check 281666 Memory utilization of the CPU 281

7 Ladder logic LAD 28371 Introduction 283

711 Programming with LAD in general 283712 Program elements of ladder logic 285

72 Programming binary logic operations with LAD 286721 NO and NC contacts 286722 Series and parallel connection of contacts 287723 T branch open parallel branch 288724 Negating result of logic operation 289725 Edge evaluation of a binary tag 289726 Comparison contacts 290

73 Programming memory functions with LAD 290731 Simple coil assignment 291732 Set and reset coils 292733 Retentive response due to latching 292734 Coils with time response 293735 Coils with counter response 294

74 Programming Q boxes with LAD 295741 Memory boxes 296742 Edge evaluation of current flow 296743 SIMATIC timer functions 297744 SIMATIC counter functions 298745 IEC timer functions 299746 IEC counter functions 300

75 Programming ENENO boxes with LAD 301751 Transfer function MOVE 302752 Arithmetic functions 302753 Math functions 303754 Conversion functions 304755 Shift functions 305756 Word logic operations 306

76 Controlling the program flow with LAD 307761 Working with status bits in the ladder logic 307762 ENENO mechanism with LAD 309763 Jump functions 310764 Block functions 311765 Master Control Relay (MCR) 313

8 Function block diagram FBD 31581 Introduction 315

811 Programming with FBD in general 315812 Program elements of the function block diagram 317

82 Programming binary logic operations with FBD 318821 Scanning for signal states ldquo1rdquo and ldquo0rdquo 318822 Programming a binary logic operation in the function block diagram 319

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 11: cover - cdn1.ozone.ru

Table of contents

11

569 Reading additional interrupt information 21257 Error handling 213

571 Causes of errors and error responses 213572 Synchronous error 213573 Enabling and disabling synchronous error processing 215574 Enter substitute value 218575 Asynchronous errors 218576 Disable delay and enable interrupts and asynchronous errors 224

58 Diagnostics 226581 Diagnostics interrupt organization block OB 82 226582 Read system state list 227583 Read start information 228584 Determine connection status 229585 System diagnostics with Report System Errors 231

59 Configure alarms 233591 Introduction 233592 Configuring alarms according to the message numbering 236593 Message blocks for PLC alarms with instance data 241594 Message blocks for PLC alarms without instance data 244595 Blocks for working with alarms 246596 Configuring a user diagnostic alarm 249597 CPU alarm display 250

6 Program editor 25361 Introduction 25362 PLC tag table 254

621 Editing PLC tag tables 254622 Defining PLC tags 254623 Exporting and importing a PLC tag table 256624 Constants tables 257

63 Programming a code block 257631 Creating a new code block 257632 Working area of program editor for code blocks 258633 Specifying code block properties 260634 Programming a block interface 260635 Programming a control function 262636 Editing tags 266637 Working with program comments 268

64 Programming a data block 270641 Creating a new data block 270642 Working area of program editor for data blocks 270643 Defining properties for data blocks 271644 Declaring data tags 272645 Entering data tags in global data blocks 273

65 Compiling blocks 273651 Starting the compilation 273652 Compiling SCL blocks 274653 Eliminating errors following compilation 275

66 Program information 276661 Cross-reference list 276662 Assignment list 278

Table of contents

12

663 Call structure 279664 Dependency structure 280665 Consistency check 281666 Memory utilization of the CPU 281

7 Ladder logic LAD 28371 Introduction 283

711 Programming with LAD in general 283712 Program elements of ladder logic 285

72 Programming binary logic operations with LAD 286721 NO and NC contacts 286722 Series and parallel connection of contacts 287723 T branch open parallel branch 288724 Negating result of logic operation 289725 Edge evaluation of a binary tag 289726 Comparison contacts 290

73 Programming memory functions with LAD 290731 Simple coil assignment 291732 Set and reset coils 292733 Retentive response due to latching 292734 Coils with time response 293735 Coils with counter response 294

74 Programming Q boxes with LAD 295741 Memory boxes 296742 Edge evaluation of current flow 296743 SIMATIC timer functions 297744 SIMATIC counter functions 298745 IEC timer functions 299746 IEC counter functions 300

75 Programming ENENO boxes with LAD 301751 Transfer function MOVE 302752 Arithmetic functions 302753 Math functions 303754 Conversion functions 304755 Shift functions 305756 Word logic operations 306

76 Controlling the program flow with LAD 307761 Working with status bits in the ladder logic 307762 ENENO mechanism with LAD 309763 Jump functions 310764 Block functions 311765 Master Control Relay (MCR) 313

8 Function block diagram FBD 31581 Introduction 315

811 Programming with FBD in general 315812 Program elements of the function block diagram 317

82 Programming binary logic operations with FBD 318821 Scanning for signal states ldquo1rdquo and ldquo0rdquo 318822 Programming a binary logic operation in the function block diagram 319

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 12: cover - cdn1.ozone.ru

Table of contents

12

663 Call structure 279664 Dependency structure 280665 Consistency check 281666 Memory utilization of the CPU 281

7 Ladder logic LAD 28371 Introduction 283

711 Programming with LAD in general 283712 Program elements of ladder logic 285

72 Programming binary logic operations with LAD 286721 NO and NC contacts 286722 Series and parallel connection of contacts 287723 T branch open parallel branch 288724 Negating result of logic operation 289725 Edge evaluation of a binary tag 289726 Comparison contacts 290

73 Programming memory functions with LAD 290731 Simple coil assignment 291732 Set and reset coils 292733 Retentive response due to latching 292734 Coils with time response 293735 Coils with counter response 294

74 Programming Q boxes with LAD 295741 Memory boxes 296742 Edge evaluation of current flow 296743 SIMATIC timer functions 297744 SIMATIC counter functions 298745 IEC timer functions 299746 IEC counter functions 300

75 Programming ENENO boxes with LAD 301751 Transfer function MOVE 302752 Arithmetic functions 302753 Math functions 303754 Conversion functions 304755 Shift functions 305756 Word logic operations 306

76 Controlling the program flow with LAD 307761 Working with status bits in the ladder logic 307762 ENENO mechanism with LAD 309763 Jump functions 310764 Block functions 311765 Master Control Relay (MCR) 313

8 Function block diagram FBD 31581 Introduction 315

811 Programming with FBD in general 315812 Program elements of the function block diagram 317

82 Programming binary logic operations with FBD 318821 Scanning for signal states ldquo1rdquo and ldquo0rdquo 318822 Programming a binary logic operation in the function block diagram 319

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 13: cover - cdn1.ozone.ru

Table of contents

13

823 AND function 320824 OR function 320825 Exclusive OR function 321826 Combined binary logic operations negating result of logic operation 321827 T branch 322828 Edge evaluation of binary tags 322829 Comparison functions 323

83 Programming standard boxes with FBD 324831 Assign box 324832 Set and reset boxes 325833 Standard boxes with time response 326834 Standard boxes with counter response 326

84 Programming Q boxes with FBD 327841 Memory boxes 328842 Edge evaluation of result of logic operation 329843 SIMATIC timer functions 329844 SIMATIC counter functions 331845 IEC timer functions 331846 IEC counter functions 332

85 Programming ENENO boxes with FBD 333851 Transfer function MOVE 334852 Arithmetic functions 335853 Math functions 335854 Conversion functions 336855 Shift functions 338856 Word logic operations 338

86 Controlling the program flow with FBD 340861 Working with status bits in the function block diagram 340862 ENENO mechanism with FBD 342863 Jump functions 343864 Block functions 344865 Master Control Relay (MCR) 346

9 Statement list STL 34891 Introduction 348

911 Programming with STL in general 348912 Structure of an STL statement 349

92 Programming binary logic operations with STL 350921 Processing of a binary logic operation operation step 350922 Scanning for signal states ldquo1rdquo and ldquo0rdquo 352923 Programming a binary logic operation in the statement list 353924 AND function 354925 OR function 354926 Exclusive OR function 354927 Combined binary logic operations 355928 Control of result of logic operation 357

93 Programming memory functions with STL 358931 Assignment 359932 Setting and resetting 359933 Edge evaluation 360

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 14: cover - cdn1.ozone.ru

Table of contents

14

94 Programming timer and counter functions with STL 361941 SIMATIC timer functions 361942 SIMATIC counter functions 363943 IEC timer functions 364944 IEC counter functions 365

95 Programming digital functions with STL 366951 Transfer functions 367952 Comparison functions 367953 Arithmetic functions 370954 Math functions 373955 Conversion functions 374956 Shift functions 375957 Word logic operations 377

96 Controlling the program flow with STL 380961 Working with status bits in the statement list 380962 ENENO mechanism with STL 382963 Jump functions 384964 Jump list 385965 Loop jump 385966 Block functions 386967 Master Control Relay (MCR) 389

97 Further STL functions 390971 Accumulator functions 390972 Adding of constants to accumulator 1 393973 Decrementing incrementing 394974 Null instructions 395

10 Structured Control Language SCL 397101 Introduction to programming with SCL 397

1011 Programming with SCL in general 3971012 SCL statements and operators 398

102 Programming binary logic operations with SCL 4011021 Scanning for signal states ldquo1rdquo and ldquo0rdquo 4011022 AND function 4021023 OR function 4031024 Exclusive OR function 4031025 Combined binary logic operations 4031026 Negating result of logic operation 404

103 Programming memory functions with SCL 4041031 Value assignment of a binary tag 4051032 Setting and resetting 4051033 Edge evaluation 405

104 Programming timer and counter functions with SCL 4061041 SIMATIC timer functions 4061042 SIMATIC counter functions 4071043 IEC timer functions 4081044 IEC counter functions 408

105 Programming digital functions with SCL 4091051 Transfer function value assignment of a digital tag 4101052 Comparison functions 4101053 Arithmetic functions 4111054 Math functions 412

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 15: cover - cdn1.ozone.ru

Table of contents

15

1055 Conversion functions 4131056 Shift functions 4141057 Word logic operations logic expression 415

106 Controlling the program flow with SCL 4161061 Working with the ENO tag 4161062 ENENO mechanism with SCL 4171063 Control statements 4191064 Block functions 428

11 S7-GRAPH sequential control 431111 Introduction 431

1111 What is a sequential control 4311112 Properties of a sequential control 4321113 Program for a sequential control quantity framework 4331114 Operating modes 4331115 Procedure for configuration 434

112 Elements of a sequential control 4341121 Steps and transitions 4341122 Jumps in a sequential control 4361123 Branching of a sequencer 4361124 GRAPH-specific tags 4371125 Permanent instructions 4381126 Step and transition functions 4391127 Processing of actions 442

113 Configuring a sequential control 4481131 Programming the GRAPH function block 4481132 Configuring the sequencer structure 4491133 Programming steps and transitions 4511134 Programming permanent instructions 4521135 Configuring block-independent alarms 4531136 Attributes of the GRAPH function block 4531137 Using the GRAPH function block 454

114 Testing the sequential control 4551141 Loading the GRAPH function block 4561142 Settings for program testing 4561143 Using operating modes 4571144 Synchronization a sequencer 4581145 Testing with program status 458

12 Basic functions 461121 Binary logic operations 461

1211 Introduction 4611212 Working with binary signals 4621213 AND function series connection 4641214 OR function parallel connection 4651215 Exclusive OR function non-equivalence function 4651216 Negate result of logic operation NOT contact 466

122 Memory functions 4681221 Introduction 4681222 Standard coil assignment 469

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 16: cover - cdn1.ozone.ru

Table of contents

16

1223 Single setting and resetting 4691224 Dominant setting and resetting memory function 4711225 Edge evaluation 472

123 SIMATIC timer functions 4771231 Overview 4771232 Programming a timer function 4801233 Timer response as pulse 4821234 Timer response as extended pulse 4841235 Timer response as ON delay 4861236 Timer response as retentive ON delay 4871237 Timer response as OFF delay 489

124 IEC timer functions 4911241 Introduction 4911242 Pulse generation TP 4921243 ON delay TON 4931244 OFF delay TOF 494

125 SIMATIC counter functions 4951251 Overview 4951252 Programming a counter function 4981253 Principle of operation of a counter function 4991254 Enabling a counter function with STL 501

126 IEC counter functions 5021261 Introduction 5021262 Up counter CTU 5031263 Down counter CTD 5041264 Updown counter CTUD 505

13 Digital functions 507131 General information 507132 Transfer functions 508

1321 General information on the ldquosimplerdquo transfer function 5081322 MOVE box with LAD and FBD 5081323 Loading and transferring with STL 5101324 Value assignments with SCL 5111325 Copying and filling a data area in the work memory 5131326 Control memory area with MCR dependency 515

133 Comparison functions 5181331 Execution of ldquosimplerdquo comparison function 5181332 Comparison function T_COMP 5201333 Comparison function S_COMP 521

134 Arithmetic functions 5211341 General function description 5231342 Data types and status bits for an arithmetic function 5231343 Execution of the arithmetic function 5241344 Arithmetic functions for date and time 525

135 Math functions 5271351 General function description 5271352 General execution of a math function 5271353 Trigonometric functions SIN COS TAN 5281354 Arc functions ASIN ACOS ATAN 5291355 Additional math functions 529

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 17: cover - cdn1.ozone.ru

Table of contents

17

136 Conversion functions 5311361 Implicit data type conversion 5311362 Data type conversion of fixed-point numbers 5321363 Data type conversion of floating-point numbers 5351364 Data type conversion for datetime with T_CONV 5371365 Data type conversion for data type STRING with S_CONV 5391366 Data type conversion of hexadecimal numbers 5401367 Scaling and unscaling 5411368 Further conversion functions 543

137 Shift functions 5441371 General function description 5441372 General execution of a shift function 5441373 Shift to right 5461374 Shift to left 5471375 Rotate to right 5471376 Rotate to left 5481377 Rotating by the condition code bit CC1 (STL) 549

138 Logic functions 5491381 Word logic operations 5491382 Invert 5521383 Code bit and set bit number 5521384 Selection and limiting functions 553

139 Functions for strings 556

14 Program flow control 560141 Status bits 561

1411 Description of the status bits 5611412 Controlling the status bits 5631413 Setting and resetting the result of logic operation 5631414 Controlling the binary result 5651415 Evaluating the status bits 566

142 Jump functions 5681421 Introduction 5681422 Absolute jump 5681423 Conditional jump functions 5701424 Jump functions depending on status bits 572

143 Block end functions 5751431 Block end function RET (LAD and FBD) 5751432 Block end functions BEC BEU and BE (STL) 5761433 RETURN statement (SCL) 576

144 Calling of code blocks 5761441 General information on block calls 5761442 Calling a function (FC) 5771443 Calling a function block (FB) 5791444 Change to a block without block parameter 581

145 Data block functions 5831451 Opening a data block 5831452 Additional data block functions with STL 5841453 Creating deleting and testing data blocks 585

146 Master control relay 5871461 Introduction 5871462 MCR dependency 588

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 18: cover - cdn1.ozone.ru

Table of contents

18

1463 MCR area and MCR zone 5891464 MCR area and MCR zone with a block change 5891465 Statements for the master control relay 591

15 Online operation and program test 592151 Connection of a programming device to the PLC station 593

1511 Settings on the programming device 5931512 Connecting the programming device to the PLC station 5941513 Switching on online mode 595

152 Transferring project data 5961521 Loading project data for the first time 5961522 Reloading the project data 5981523 Protection of the user program 5991524 Editing of online project without offline project 6001525 Working with the memory card 601

153 Block handling 6021531 Downloading a block to the CPU 6021532 Editing the online version of a block 6031533 Deleting a block 6031534 Packing the work memory 6031535 Offlineonline data blocks 6041536 Comparing blocks 605

154 Hardware diagnostics 6081541 Status displays on the modules 6081542 Diagnostic information 6091543 Diagnostic buffer 6091544 Diagnostic functions 6101545 Online tools 6111546 Further diagnostic information via the programming device 612

155 Testing the user program 6131551 Process and test modes 6131552 Defining the call environment 6141553 Testing with program status 6141554 Testing in single step mode 6181555 Monitoring of PLC tags 6211556 Monitoring of data tags 6211557 Testing with watch tables 6221558 Enable peripheral outputs 6271559 Testing with the force table 628

16 Distributed IO 631161 Introduction overview 631162 ET 200 distributed IO system 632

1621 ET 200L 6321622 ET 200M 6321623 ET 200S 6331624 ET 200iSP 6341625 ET 200R 6341626 ET 200eco 6341627 ET 200pro 635

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 19: cover - cdn1.ozone.ru

Table of contents

19

163 PROFINET IO 6361631 PROFINET IO components 6361632 Addresses with PROFINET IO 6381633 Special PROFINET configurations 6411634 Configuring PROFINET IO 6421635 Coupling modules for PROFINET IO 6461636 Real-time communication with PROFINET IO 647

164 PROFIBUS DP 6491641 PROFIBUS DP components 6491642 Addresses with PROFIBUS DP 6521643 Configuring PROFIBUS DP 6561644 Coupling modules for PROFIBUS DP 6591645 Special functions for PROFIBUS DP 661

165 System blocks for distributed IO 6651651 System blocks for PROFIBUS DP 6651652 System blocks for PROFIBUS DP and PROFINET IO 6681653 System block for PROFINET IO 672

17 Communication 674171 Overview 674172 S7 basic communication 675

1721 Basics of station-internal S7 basic communication 6751722 Configuring of station-internal S7 basic communication 6761723 System blocks for station-internal S7 basic communication 6761724 Basics of station-external S7 basic communication 6781725 Configuring of station-external S7 basic communication 6791726 System blocks for station-external S7 basic communication 679

173 S7 Communication 6821731 Basics 6821732 Configuring S7 communication 6841733 One-way data exchange 6851734 Two-way data exchange 6861735 Control functions 6881736 Monitoring functions 6901737 Send print data 691

174 Open user communication 6921741 Basics 6921742 Establishing and terminating connections 6931743 Data transfer with TCP native or ISO-on-TCP 6961744 Data transfer with UDP 698

175 Point-to-point communication 7001751 Basics 7001752 Data transmission with the 3964 (R) procedure 7021753 Data transmission with the RK 512 protocol 7021754 Data transmission with the ASCII driver 705

18 Appendix 707181 Working with source files 707

1811 General procedure 7071812 Programming a logic block in the source file 708

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 20: cover - cdn1.ozone.ru

Table of contents

20

1813 Programming a data block in the source file 7141814 Programming a PLC data type in the source file 715

182 Migrating projects 716183 Simulation with the TIA Portal 720

1831 Differences from a real CPU 7201832 Starting and saving the simulation 7201833 Using the simulation 7221834 Testing the program with the simulation 7241835 Additional functions of PLCSIM 725

184 Web server 7271841 Enable web server 7271842 Reading out web information 7281843 Standard web pages 728

185 Storage of local tags 7311851 Storage in global data blocks 7311852 Storage in instance data blocks 7321853 Storage in the temporary local data 7331854 Data storage of the block parameters of a function (FC) 7341855 Data storage of the block parameters of a function block (FB) 7361856 Data storage of a local instance in a multi-instance 739

Index 741

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 21: cover - cdn1.ozone.ru

11 Overview of the S7-400 automation system

21

1 Introduction

11 Overview of the S7-400 automation system

SIMATIC S7-400 is the modular control system for the medium and upper perfor-mance range (Fig 11) Different versions of the controllers allow the performanceto be matched to the respective application Depending on the requirements theprogrammable controller can be modularly expanded by inputoutput modules fordigital and analog signals in up to 21 racks with up to 18 modules

Further expansion with inputoutput modules is made possible by the distributedIO over PROFIBUS or PROFINET Special designs of these modules for increasedmechanical demands allow their installation directly on site on the machine orplant STEP 7 is used to configure and program the SIMATIC S7-400controllers Data

Fig 11 Components of the SIMATIC S7-400 automation system

SIMATIC NET

SIMATIC DP STEP 7Professional

S

S

SIMATIC S7-400 automation system

SIMATIC S7-400

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 22: cover - cdn1.ozone.ru

1 Introduction

22

exchange between the controllers the distributed IO and the programming deviceis carried out over SIMATIC NET

111 SIMATIC S7-400 programmable controller

The most important components of an S7-400 programmable controller are shownin Fig 12

The CPU contains the operating system and the user program The user program isin the load memory of the CPU which can be expanded with a SIMATIC MemoryCard (MC) The user program is executed in the CPUs work memory The bus inter-faces present on the CPU establish the connection to other programmable control-lers

Fig 12 Components of an S7-400 controller

Expansion rack

Central rack

IM module

Components of an S7-400 controller

The racka are available in various widths 18 9 and 4 slots

CPU module

PS module

SM modules

FM modules

CP modules

Rack

On the racks are pluggable

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 23: cover - cdn1.ozone.ru

11 Overview of the S7-400 automation system

23

Signal modules (SM) are responsible for the connection to the controlled plantThese input and output modules are available for digital and analog signals

The function modules (FM) are signal-preprocessing ldquointelligentrdquo IO moduleswhich prepare signals coming from the process independent of the CPU and eitherreturn them directly to the process or make them available at the CPUs internalinterface Function modules are responsible for handling functions which the CPUcannot usually execute quickly enough such as counting pulses positioning orcontrolling drives

The CP modules allow data transfer in excess of the possibilities provided by thestandard interfaces on the CPU with regard to protocols and communication func-tions

In the case of an expansion the interface modules (IM) connect the central rackto a maximum of 21 expansion racks

Finally a power supply module provides the internal voltages required by the pro-grammable controller Load voltages or load currents must be provided via externalload current supply units

112 Overview of STEP 7 Professional V11

STEP 7 is the central automation tool for SIMATIC STEP 7 requires authorization (li-censing) and is executed on the current Microsoft Windows operating systemsConfiguration of an S7-400 controller is carried out in two views the Portal viewand the Project view

The Portal view is task-oriented

In the Start portal you can open an existing project create a new project or migratea project A ldquoprojectrdquo is a data structure containing all the programs and datarequired for your automation task The most important STEP 7 tools and functionscan be accessed from here via further portals (Fig 13)

b In the Devices amp networks portal you configure the programmable controllersie you position the modules in a rack and set their parameters

b In the PLC programming portal you create the user program in the form of indi-vidual sections referred to as ldquoblocksrdquo

b The Visualization portal provides the most important tools for configuration andsimulation of HMI systems using SIMATIC WinCC

b The Online amp Diagnostics portal allows you to connect the programming deviceonline to a CPU You can control the CPUs operating modes and transfer and testthe user program

The Project view is an object-oriented view with several windows whose contentschange depending on the current activity In the Device configuration the focalpoint is the working area with the device to be configured The Device view includesthe rack and the modules which have already been positioned (Fig 14) A furtherwindow ndash the inspector window ndash displays the properties of the selected module

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 24: cover - cdn1.ozone.ru

1 Introduction

24

Fig 13 Tools in the Start portal of STEP 7 Professional V11

Fig 14 Example of a Project view working area of the device configuration

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 25: cover - cdn1.ozone.ru

11 Overview of the S7-400 automation system

25

and the task window provides support by means of the hardware catalog with theavailable modules The Network view allows networking between PLC and HMI sta-tions

When carrying out PLC programming you edit the selected block in the workingarea You are again shown the properties of the selected object in the inspector win-dow where you can adjust them In this case the task window contains the programelements catalog with the available program elements and statements The sameapplies to the processing of PLC tags or to online program testing using watchtables

And you always have a view of the project navigation This contains all objects of theSTEP 7 project You can therefore select an object at any time for example a pro-gram block or watch table and edit this object using the corresponding editorswhich start automatically when the object is opened

113 Five programming languages

You can select between five programming languages for the user program ladderlogic (LAD) function block diagram (FBD) statement list (STL) structured controllanguage (SCL) and sequential control (GRAPH)

Using the ladder logic you program the control task based on the circuit diagramOperations on binary signal states are represented by serial or parallel arrange-ment of contacts and coils (Fig 15) Complex functions such as arithmetic func-tions are represented by boxes which you arrange like contacts or coils in the ladderdiagram

Using the function block diagram you program the control task based on electroniccircuitry systems Binary operations are implemented by linking AND and OR func-tions and terminated by memory boxes (Fig 16) Complex boxes are used to handlethe operations on digital tags for example with arithmetic functions

Using the statement list you program the control task using a sequence of state-ments Every STL statement contains the specification of what has to be done andpossibly an operand with which the operation is executed STL is equally suitable

Fig 15 Example of representation in ladder logic

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 26: cover - cdn1.ozone.ru

1 Introduction

26

for binary and digital operations and for programming complex open-loop controltasks (Fig 17)

Structured control language is particularly suitable for programming complex al-gorithms or for tasks in the area of data management The program is made up ofSCL statements which for example can be value assignments comparisons orcontrol statements (Fig 18)

Fig 16 Example of representation in function block diagram

Fig 17 Example of STL statements

Fig 18 Example of SCL statements

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 27: cover - cdn1.ozone.ru

11 Overview of the S7-400 automation system

27

Using GRAPH you program a control task as a sequence control in which a se-quence of actions prevails The individual steps and branches are enabled by stepenabling conditions which can be programmed using LAD or FBD (Fig 19)

114 Execution of the user program

After the power supply has been switched on the control processor checks the con-sistency of the hardware and parameterizes the modules A startup program is thenexecuted once if present The startup program belongs to the user program whichyou produce Modules can be initialized for example by the startup program

The user program is usually divided into individual sections called ldquoblocksrdquo The or-ganization blocks (OB) represent the interface between operating system and userprogram The operating system calls an organization block for specific events andthe user program is then processed in it (Fig 110)

Function blocks (FB) and functions (FC) are available for structuring the programFunction blocks have a memory in which local tags are saved permanently func-tions do not have this memory

Program statements are available for calling function blocks and functions (start ofexecution) Each block call can be assigned inputs and outputs referred to as ldquoblockparametersrdquo During calling tags can be transferred with which the program in theblock is to work In this manner a block can be repeatedly called with a certain func-tion (eg addition of three tags) but with different parameters sets (eg for differ-ent calculations) (Fig 111)

Fig 19 Example of a GRAPH sequencer and step configuration

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 28: cover - cdn1.ozone.ru

1 Introduction

28

The data of the user program is saved in data blocks (DB) Instance data blocks havea fixed assignment to a call of a function block and are the tag memory of the func-tion block Global data blocks contain data which is not assigned to any block

Following a restart the control processor updates the input and output signals inthe process images and calls the organization block OB 1 The main program ispresent here Structuring is also possible and recommended in the main programOnce the main program has been processed the control processor returns to theoperating system retains (for example) communication with the programming de-vice updates the input and output signals and then recommences with executionof the main program

Fig 110 Execution of the user program

Fig 111 Example of two block calls with different tags in each case

Startupprogram

Alarm and errorprogram

Mainprogram

Execution of the user program

Switching on

Updating of inputsand outputs

Interruption(alarm or error)

Operating modeSTARTUP

Operating system User program

Operating modeRUN

OB

OB

FBFC

FBFC

FBFC

FBFC

FBFC

FBFC

OB

Interruption

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 29: cover - cdn1.ozone.ru

11 Overview of the S7-400 automation system

29

Cyclic program execution is a feature of programmable logic controllers The userprogram is also executed if no actions are requested ldquofrom outsiderdquo eg if the con-trolled machine is not running This provides advantages when programming Forexample you program the ladder logic as if you were drawing a circuit diagram orprogram the function block diagram as if you were connecting electronic compo-nents Roughly speaking a programmable controller has a characteristic like forexample a contactor or relay control the many programmed operations are effec-tive quasi simultaneously ldquoin parallelrdquo

In addition to the cyclically executed main program it is possible to carry out inter-rupt-controlled program execution You must enable the corresponding interruptevent for this This can be a hardware interrupt such as a request from the con-trolled machine for a fast response or a cyclic interrupt in other words an eventwhich takes place at defined intervals

The control processor interrupts execution of the main program when an event oc-curs and calls the assigned interrupt program Once the interrupt program hasbeen executed the control processor continues execution of the main programfrom the point of interruption

Fig 112 Data management in the SIMATIC S7-400 automation system

Work memory

Load memory

Hard disk

Power supply

Memory Card MC

Programming device

Transfer with online connection or Memory Card

Transfer when switching on

The memory card expandsthe load memory RAM and FLASH

memory cards with different memorysizes are available

A backup battery protectsthe program code and data in

the load and work memoryin the event of a power failure

Data management in the SIMATIC S7-400 automation system

Main memory Saving the project data

All project data is executedin the programming

devices main memory

The offline project data issaved on the hard disk

The work memory contains the executablepart of the control program which is

processed during runtime

The load memory contains the project datatransferred to the CPU Together with the current

values of the tags from the work memorythey form the online project data

CPU 400

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 30: cover - cdn1.ozone.ru

1 Introduction

30

115 Data management in the SIMATIC automation system

The automation data is present in various memory locations in the automationsystem First of all there is the programming device All automation data of aSTEP 7 project is saved on its hard disk Configuration and programming of theproject data with STEP 7 are carried out in the main memory of the programmingdevice (Fig 112)

The automation data on the hard disk is also referred to as the offline project dataOnce STEP 7 has appropriately compiled the automation data this can be down-loaded to a connected programmable controller The data downloaded into the usermemory of the CPU is known as the online project data

The user memory on the CPU is divided into two components The load memorycontains the complete user program including the configuration data and thework memory contains the executable user program with the current control dataThe load memory can be expanded by means of a plug-in memory card (MC) Dataretentivity ndash data values are not lost if there is a power failure ndash is achieved by usinga backup battery

The project data can be transferred between the programming device and CPU us-ing a FLASH memory card The normal case is an online connection for transfertesting and diagnostics

12 Introduction to STEP 7 Professional V11

121 Installing STEP 7

STEP 7 Professional V11 is executed onWindows XP Professional SP3 Win-dows 2003 Server R2 StdE SP2 Win-dows 7 (Professional Enterprise Ulti-mate) 32-bit and 64-bit and Windows2008 Server StdE SP2 operating sys-tems You require administrationrights in order to install STEP 7 and towork with STEP 7 you must at least belogged-on as a main user

The processor should at least be a Pentium M with 16 GHz or a comparable typeThe main memory should have a minimum size of 1 GB STEP 7 Professional re-quires approximately 2 GB free memory on system drive C on the hard disk

An interface module with an appropriate port is required on the programming de-vice for the online connection to the programmable controller The connection canbe established over MPI PROFIBUS or PROFINET (Ethernet) If you want to workwith a programming device with a memory card you need a corresponding EPROMprogramming module

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 31: cover - cdn1.ozone.ru

12 Introduction to STEP 7 Professional V11

31

Installation is carried out using the setup program startexe on the DVD Uninstal-lation of STEP 7 Professional is carried out as usual in Windows using the Softwareprogram in the Windows Control Panel

122 Automation License Manager

You require a license (user authorization) in order to use STEP 7 Licenses are man-aged by the Automation License Manager which is installed together with STEP 7Professional The license for STEP 7 Professional (license key) is provided on a USBflash drive You will be requested to provide authorization during installation if alicense key is not yet present on the hard disk You can also carry out the authori-zation following installation of STEP 7

The license key is stored on the hard disk in specially identified blocks To avoid un-intentional destruction of the license key you should observe the information forhandling license keys in the help text of the Automation License Manager If youlose the license key eg due to a defective hard disk you can revert to the trial li-cense delivered with STEP 7 which is valid for a limited duration

The Automation License Manager also manages the license keys of other SIMATICproducts such as STEP 7 V55 and WinCC When uninstalling STEP 7 V11 ensurethat the relevant license is also removed If the license is still needed you shouldback it up first

123 Starting STEP 7 Professional

You start STEP 7 Professional either using the Start button of Win-dows and Programs gt Siemens Automation gt TIA Portal V11 or bydouble-clicking on the icon on the Windows desktop The Totally In-tegrated Automation Portal (TIA Portal) is the framework in whichSTEP 7 is embedded TIA Portal may also contain other applicationsthat use the same database such as WinCC Professional

124 Portal view

Following initial starting-up STEP 7 Professional displays the Start portal A portalmakes available all functions and tools required for the respective range of tasks inthe portal view The scope of the portals as well as the range of functions and toolsdepends on the installed applications The Start portal of STEP 7 Professional per-mits selection of the following portals (Fig 113)

b In the Devices amp networks portal you can configure the hardware of the program-mable controller ie you select the hardware components position them andset their properties If several devices are networked you can define the connec-tions here

b The PLC programming portal contains all the tools required for generating theuser program for a PLC station

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 32: cover - cdn1.ozone.ru

1 Introduction

32

b In the Visualization portal you generate the operator control and monitoring in-terface for HMI stations Here you can configure for example the process imag-es the control elements and messages

b Using the Online amp Diagnostics portal you can connect the programming deviceto a programmable controller transfer and test programs and search (and de-tect) faults in the automation system

Additional functions included in the Start portal are Create new project Openexisting project and Migrate project The Welcome Tour and First steps provide an in-troduction to STEP 7 Installed software provides an overview of further SIMATIC ap-plications that are currently available on the programming device You can callHelp in every portal The User interface language allows you to set the language forworking with STEP 7

Fig 113 Portal view First steps after opening a project

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 33: cover - cdn1.ozone.ru

12 Introduction to STEP 7 Professional V11

33

125 Help information system

During programming the helpfunction of STEP 7 provides youwith comprehensive support forsolving your automation task

To call the help function click onHelp in the Portal view or select theHelp gt Show help command in themain menu in the Project view Awindow appears with the help in-formation system (Fig 114)

The online help is roughly dividedaccording to the project processingsteps Configuration parameter-ization and networking of devicesstructuring and programming ofthe user program visualization ofprocesses and utilization of the on-line and diagnostics functions

Readme provides general informa-tion on STEP 7 and further informa-tion which could no longer be in-cluded in the online help

A comprehensive description of allavailable statements including ex-tended statements can be found un-der Programming a PLC and Refer-ences

126 The windows of the Project view

The Project view shows all elements of a project in structured form in various pro-cessing windows You can move from the Portal view to the Project view using theProject view link at the bottom left of the screen or STEP 7 automatically switchesto the Project view depending on the selected tool

Fig 115 shows the windows of the Project view in an example of block program-ming Different window contents are displayed depending on the currently usededitor

a Main menu and toolbar shortcut menu

Underneath the title bar is the main menu with all menu commands The menucommands available for selection depend on the currently marked object menucommands which cannot be selected are displayed in gray The same functionalityis available ndash somewhat user-friendlier ndash with the shortcut menu If you click on an

Fig 114 Start page of the information system

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 34: cover - cdn1.ozone.ru

1 Introduction

34

object with the right mouse button a window is opened with the currently select-able menu commands Underneath the main menu is the toolbar with the graphi-cally represented ldquomain functionsrdquo The main menu and the toolbar are alwayspresent in all editors

Using Options gt Settings in the main menu you can adapt the user interface Forexample under ldquoGeneralrdquo you can define the user interface language in whichSTEP 7 is used and the mnemonics (the representation of the operands ldquoIrdquo forinput in English or ldquoErdquo in German)

s Working window

In the center of the screen is the working window The contents of the working win-dow depend on the editor currently being used In the case of device configurationthe working window is divided in two the objects (stations and modules) are dis-played in graphic form in the top part and in tabular form in the bottom part Whenprogramming the PLC the top part of the working window contains the interfacedescription of the block and the bottom part the program You use the workingwindow to configure the hardware of the automation system generate the userprogram or configure the process screens for an HMI device

Fig 115 Components of Project view using example of block programming

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 35: cover - cdn1.ozone.ru

12 Introduction to STEP 7 Professional V11

35

d Inspector window

The inspector window underneath the working window shows the properties of theobjects marked in the latter records the sequence of actions and provides an over-view of the diagnostics status of the connected devices

During configuration or programming you set the object properties in the inspec-tor window for example the addresses and symbol names of inputs and outputsthe properties of the PROFINET interface tag data types or block attributes

f Project tree

The project tree window is displayed with the same content for all editors Its hier-archical structure contains all project data and the required editors With the proj-ect open it shows the folders for the PLC and HMI stations included in the projectand further subfolders within these folders eg for program blocks PLC tags andwatch tables with a PLC station or for example the process images and the HMItags in the case of an HMI station

A double-click on an object with project data automatically starts the associated ed-itor The project tree also includes editors such as Add new device Device configura-tion or Online amp diagnostics which you can start directly by means of a double-click

The lower section of the project tree contains a details view of those objects whichare present in the hierarchy underneath the object marked in the project tree

g Task window

To the right of the working window is the task window with the task cards This con-tains further objects for processing in the working window The contents of the taskwindow depend on the currently active editor In the case of the hardware configu-ration for example the hardware catalog with the available components is shownhere in the case of PLC programming the program elements catalog appears withonline amp diagnostics the online tools and with the visualization the library for theprocess image control and display elements

You can also call the libraries in this window Global libraries supplied with STEP 7or the project library in which you can save reusable objects such as programblocks templates for process images or control elements with special configura-tions

h Editor and status bar

At the bottom left of the Project view you can change to the Portal view In the mid-dle you can see the tabs of the open windows Clicking on a tab results in its contentsbeing displayed in the top level of the working window This makes it easy to changequickly between different window contents The far right of the status bar indicatesthe current status of project processing

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 36: cover - cdn1.ozone.ru

1 Introduction

36

127 Adapting the user interface

The language of the user interface can be changed In the main menu select the sec-tion General under Options gt Settings In the User interface language drop-down listyou can select the desired language from the installed languages The texts of theuser interface are then immediately displayed in the new language You can also de-fine here how TIA Portal is to be displayed following the next restart

You can show or hide the displayed window using the menu item View You can al-ways change the size of windows by dragging on its edge with the mouse Windowscan be minimized into a symbol which appears in one of the navigation bars in theleft bottom or right margin of the screen

You can separate the working window completely from the Project view so that it isdisplayed as a separate window (symbol for Float in the title bar of the working win-dow) and also insert it again (symbol for Embed) Using the symbol for ldquoMaximizerdquoall other windows are closed and the working window is displayed in maximumsize The working window can be divided vertically or horizontally permitting youto view two working areas simultaneously

You can change the width of table columns by dragging with the cursor in the tableheader In the case of columns that are too narrow the entire content of the individ-ual cells will appear as a tooltip when the cursor is briefly hovered over the relevantfield

13 Editing a SIMATIC project

Fig 116 shows all tools and data which can be of importance in an automation taskOf prime importance is the Project which contains all the automation data requiredfor control and operation of the machine or plant The project data is roughly divid-ed into the data for the individual stations and the common project data which ap-plies to all stations in the project

A Station can be a controller (PLC station) an HMI device (HMI station) or a PC sta-tion A project can include several stations but at least one station must be presentThe data present in a station is described later in this book Common project dataincludes for example centrally managed message texts or texts for multilingualprojects

A project library can be created for each project Objects which are used in severalprojects are combined in global libraries Also relevant to a project is the program-ming device design with interface modules (eg LAN adapters) and memory cardreaders

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 37: cover - cdn1.ozone.ru

13 Editing a SIMATIC project

37

131 Structured representation of project data

The project tree in the Project view displays the project data and the programmingdevice design in a tree structure (Fig 117)

The structure also includes the editors (tools) required for generating and editingthe data The project tree does not include the project library This is represented ina task card together with the global libraries in the task window under ldquoLibrariesrdquo

You can replace the names shown in angle brackets by names more appropriate toyour automation task

132 Project data and editors for a PLC station

If you add a PLC station (an S7-400 controller) to the project STEP 7 creates the cor-responding structure in the project data (Fig 118) A station is always required forediting in a project so that STEP 7 can create the data structures required for pro-gramming or configuration If you wish to write a user program without previouslyselecting a specific CPU you can select an ldquounspecified CPU 400rdquo from the hardwarecatalog and replace it later with a ldquorealrdquo CPU 400 if necessary

Fig 116 Project components libraries and programming device design

Global libraries

Programming device design

Libraries delivered with STEP 7 Libraries configured by users themselves

Global libraries contain elements for use across projects

Contains the programming device resources relevant to the project

All the data for the automation task is combined in a project

A project includes at least one station Contains cross-station data

Contains all the data for acontroller

Contains text lists for system and user messages

Contains all the data for an HMIdevice

Contains all the data for a PCsystem or PC application

Contains project texts project languages andgraphics

Contains the templates and settings fordocumentation of project data

Project

Contains data compiled by the user

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 38: cover - cdn1.ozone.ru

1 Introduction

38

The user program which controls the machine or process is located in the Programblocks folder The program comprises blocks (separate program components)which are either stored directly in the Program blocks folder or ndash if there is a largenumber ndash in subfolders which you can create and configure yourself The Mainblock (ldquomain programrdquo the name is the symbol for the block and can be changed)is the organization block OB 1 and is created automatically The processing se-quence of the blocks is defined in the user program by ldquoblock callsrdquo and can bemade visible using the Program info editor (further down in the project tree) in acall and dependency structure

Fig 117 Project structure in the project tree

lt Project

Online access

SIMATIC Card Reader

Interface x1

lt PLC station gt

Common data

Documentation settings

Interface x2

lt PLC gt

lt PLC station_1 gt

Languages amp resources

Add new device

Devices amp networks

Update accessiblestations

Add user-defined card reader

Card reader

Folder with the data of a found station

Folder for all data of an automation system

Folder for all LAN interface modules of the programming device

Folder for all SD card readers of the programming device

LAN interface of programming device

Folder for all data of a PLC station

Folder for common data in the project

Folder for common data in the project

Further LAN interface modules if applicable

Folder for the data of a further PLC station

Folder for language-dependent objects

Project navigation with opened project

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks

Page 39: cover - cdn1.ozone.ru

13 Editing a SIMATIC project

39

Fig 118 Structure of the project data for a PLC station

lt PLC_xxx gt

Program blocks

PLC data types

Local modules

Technology objects

PLC tags

lt Group_1 gt

lt Group_1 gt

Device configuration

Add new block

Add new watch table

Add new data type

lt PLC data type_1 gt

PLC module

lt Other modules gt

Add new object

Add new external file

lt External program source gt

Show all tags

Add new tag table

Standard tag table [n]

lt Tag table [n] gt

Online amp diagnostics

Main [OB1]

lt Watch table_2

lt Block_2 gt

PLC tags (n)

lt Block_1 gt

lt Watch table_1 gt

Force table

Text lists

PLC alarms

Program info

Folder for all data of a PLC station (name can be freely selected)

Folder for all blocks of the user program

Folder for all watch and force tables

Folder for all PLC data types

Folder for the local modules of the PLC station

Folder for all technology objects

Folder for the program sources

Folder for all PLC tags

Data structure of a PLC station

lt Technology object_1 gt

External sources files

lt Group_1 gt

Watch and force tables

System blocks