Automating with SIMATIC S7-300 inside TIA Portal
Configuring, Programming and Testing with STEP 7 Professional
by Hans Berger
Table of contents
1 Introduction . 22
1.1 Overview of the S7-300 automation system . 22
1.1.1 SIMATIC S7-300 programmable controller . 23
1.1.2 Overview of STEP 7 Professional V12 . 24
1.1.3 Five programming languages . 26
1.1.4 Execution of the user program . 28
1.1.5 Data management in the SIMATIC automation system . 30
1.2 Introduction to STEP 7 Professional V12 . 31
1.2.1 Installing STEP 7 31
1.2.2 Automation License Manager 31
1.2.3 Starting STEP 7 Professional . 32
1.2.4 Portal view . 32
1.2.5 The windows of the Project view . 33
1.2.6 Help information system . 36
1.2.7 Adapting the user interface . 36
1.3 Editing a SIMATIC project 37
1.3.1 Structured representation of project data . 38
1.3.2 Project data and editors for a PLC station 39
1.3.3 Creating and editing a project . 42
1.3.4 Working with reference projects . 44
1.3.5 Creating and editing libraries . 45
2 SIMATIC S7-300 automation system . 46
2.1 S7-300 station components 46
2.2 S7-300 CPUs . 48
2.2.1 CPU versions 48
2.2.2 Control and display elements 50
2.2.3 SIMATIC Micro Memory Card 51
2.2.4 Memory areas in an S7-300 station . 51
2.2.5 Bus interfaces . 53
2.3 Signal modules 55
2.3.1 Digital input modules 55
2.3.2 Digital output modules . 56
2.3.3 Digital input/output modules 56
2.3.4 Analog input modules 57
2.3.5 Analog output modules . 57
2.3.6 Analog input/output modules 58
2.4 Function modules 59
2.5 Communication modules 60Table of contents
9
2.6 Other modules . 61
2.6.1 Interface modules (IM) . 61
2.6.2 Power supply modules (PS) . 62
2.6.3 Simulator module . 62
2.6.4 Dummy module . 62
2.7 SIPLUS S7-300 . 63
3 Device configuration 65
3.1 Introduction . 65
3.2 Configuring a station . 68
3.2.1 Adding a PLC station . 68
3.2.2 Adding a module 68
3.2.3 Adding an expansion rack . 69
3.3 Parameterization of modules 70
3.3.1 Parameterization of CPU properties 70
3.3.2 Addressing modules . 73
3.3.3 Assigning parameters to signal modules 75
3.4 Configuring the network 76
3.4.1 Introduction, overview . 76
3.4.2 Networking stations . 77
3.4.3 Node addresses in a subnet . 79
3.4.4 Connections 80
3.4.5 Configuring an MPI subnet . 82
3.4.6 Configuring a PROFIBUS subnet . 83
3.4.7 Configuring a PROFINET subnet . 85
3.4.8 Configuring an AS-i subnet . 89
4 Tags, addressing, and data types . 90
4.1 Operands and tags 90
4.1.1 Introduction, overview . 90
4.1.2 Operand areas: inputs and outputs . 91
4.1.3 Operand area: bit memory 93
4.1.4 Operand area: data 94
4.1.5 Operand area: temporary local data 95
4.2 Addressing of operands and tags . 96
4.2.1 Signal path . 96
4.2.2 Absolute addressing of tags . 97
4.2.3 Symbolic addressing of tags 101
4.2.4 Addressing constants . 102
4.3 Indirect addressing 103
4.3.1 Memory-indirect addressing with STL . 104
4.3.2 Register-indirect addressing with STL 107
4.3.3 Working with the address registers with STL 109
4.3.4 Direct access to complex local tags with STL 116
4.3.5 Indirect addressing with SCL . 118Table of contents
10
4.4 Elementary data types 120
4.4.1 Introduction . 120
4.4.2 Bit-serial data types BOOL, BYTE, WORD, and DWORD 123
4.4.3 BCD numbers BCD16 and BCD32 123
4.4.4 Fixed-point data types with sign INT and DINT 123
4.4.5 Floating-point data type REAL 125
4.4.6 Data type CHAR 126
4.4.7 Data types for durations and points in time . 127
4.5 Complex data types 128
4.5.1 Data type DATE_AND_TIME . 128
4.5.2 Data type STRING . 129
4.5.3 Data type ARRAY 131
4.5.4 Data type STRUCT . 133
4.6 Parameter types and pointers . 135
4.6.1 Parameter types 135
4.6.2 Pointer 136
4.6.3 “Variable” ANY pointer with STL 139
4.6.4 “Variable” ANY pointer with SCL 140
4.7 PLC data types 140
4.8 Start information 143
5 Program execution . 145
5.1 Operating states of the CPU . 145
5.1.1 STOP operating state 146
5.1.2 STARTUP operating state 147
5.1.3 RUN operating state . 149
5.1.4 HOLD operating state . 149
5.1.5 Reset CPU memory . 150
5.1.6 Restoring the factory settings 150
5.1.7 Retentive behavior of operands . 150
5.2 Creating a user program . 151
5.2.1 Program draft 151
5.2.2 Program execution 155
5.2.3 Block types 156
5.2.4 Editing block properties . 158
5.2.5 Block interface . 161
5.2.6 Example of use of block parameters . 163
5.3 Calling blocks . 165
5.3.1 General information on calling of code blocks 165
5.3.2 Calling functions (FC) . 165
5.3.3 Calling function blocks (FB) 167
5.3.4 “Passing on” of block parameters . 170
5.4 Startup program 171
5.4.1 Organization block OB 100 171
5.4.2 Determining a module address . 171
5.4.3 Parameterization of modules . 173Table of contents
11
5.5 Main program 176
5.5.1 Organization block OB 1 176
5.5.2 Process image updating . 177
5.5.3 Cycle time and response time . 178
5.5.4 Hold, stop, and protect program 181
5.5.5 Time 182
5.5.6 Read system time . 184
5.5.7 Runtime meter . 184
5.6 Interrupt processing . 186
5.6.1 Introduction to interrupt processing 186
5.6.2 Priority classes . 187
5.6.3 Time-of-day interrupt, organization block OB 10 188
5.6.4 Time-delay interrupts, organization blocks OB 20 and OB 21 191
5.6.5 Cyclic interrupts, organization blocks OB 32 to OB 35 193
5.6.6 Hardware interrupt, organization block OB 40 195
5.6.7 Interrupts for DPV1 organization blocks OB 55 to OB 57 196
5.6.8 Isochronous mode interrupt, organization block OB 61 197
5.6.9 Reading additional interrupt information 199
5.7 Error handling 200
5.7.1 Causes of errors and error responses 200
5.7.2 Synchronous error . 201
5.7.3 Enabling and disabling synchronous error processing . 202
5.7.4 Enter substitute value . 205
5.7.5 Asynchronous errors . 206
5.7.6 Disable, delay, and enable interrupts and asynchronous errors 209
5.8 Diagnostics . 211
5.8.1 Diagnostic error interrupt, organization block OB 82 211
5.8.2 Read system state list 212
5.8.3 Read start information 214
5.8.4 Write user diagnostic event to the diagnostic buffer . 215
5.8.5 System diagnostics with Report System Errors 216
6 Program editor 218
6.1 Introduction 218
6.2 PLC tag table 218
6.2.1 Working with PLC tag tables 219
6.2.2 Defining and processing PLC tags . 220
6.2.3 Comparing PLC tags 221
6.2.4 Exporting and importing a PLC tag table . 222
6.2.5 Constants tables 223
6.3 Programming a code block 223
6.3.1 Creating a new code block . 223
6.3.2 Working area of the program editor for code blocks 224
6.3.3 Specifying code block properties 226
6.3.4 Programming a block interface . 226
6.3.5 Programming a control function 228Table of contents
12
6.3.6 Editing tags 232
6.3.7 Working with program comments . 234
6.4 Programming a data block 236
6.4.1 Creating a new data block 236
6.4.2 Working area of program editor for data blocks . 236
6.4.3 Defining properties for data blocks 237
6.4.4 Declaring data tags . 238
6.4.5 Entering data tags in global data blocks 239
6.5 Compiling blocks 239
6.5.1 Starting the compilation . 239
6.5.2 Compiling SCL blocks . 241
6.5.3 Eliminating errors following compilation 241
6.6 Program information 242
6.6.1 Cross-reference list . 242
6.6.2 Assignment list . 244
6.6.3 Call structure 245
6.6.4 Dependency structure 246
6.6.5 Consistency check 247
6.6.6 Memory utilization of the CPU 248
7 Ladder logic LAD 249
7.1 Introduction 249
7.1.1 Programming with LAD in general 249
7.1.2 Program elements of ladder logic . 251
7.2 Programming binary logic operations with LAD 252
7.2.1 NO and NC contacts . 252
7.2.2 Series and parallel connection of contacts 253
7.2.3 T branch, open parallel branch . 254
7.2.4 Negating result of logic operation . 255
7.2.5 Edge evaluation of a binary tag . 255
7.2.6 Comparison contacts 256
7.3 Programming memory functions with LAD . 257
7.3.1 Simple coil, assignment . 257
7.3.2 Set and reset coils 258
7.3.3 Retentive response due to latching 259
7.3.4 Coils with time response . 260
7.3.5 Coils with counter response 260
7.4 Programming Q boxes with LAD . 261
7.4.1 Memory boxes . 261
7.4.2 Edge evaluation of current flow . 262
7.4.3 SIMATIC timer functions . 263
7.4.4 SIMATIC counter functions . 264
7.4.5 IEC timer functions . 265
7.4.6 IEC counter functions . 266
7.5 Programming EN/ENO boxes with LAD 267
7.5.1 Transfer function, MOVE . 268Table of contents
13
7.5.2 Arithmetic functions 269
7.5.3 Math functions . 269
7.5.4 Conversion functions . 270
7.5.5 Shift functions . 272
7.5.6 Word logic operations . 272
7.6 Controlling the program flow with LAD . 274
7.6.1 Working with status bits in the ladder logic . 274
7.6.2 EN/ENO mechanism with LAD 276
7.6.3 Jump functions . 277
7.6.4 Block functions . 278
7.6.5 Master Control Relay (MCR) 280
8 Function block diagram FBD 282
8.1 Introduction 282
8.1.1 Programming with FBD in general 282
8.1.2 Program elements of the function block diagram 284
8.2 Programming binary logic operations with FBD 285
8.2.1 Scanning for signal states “1” and “0” 285
8.2.2 Programming a binary logic operation in the function block diagram 286
8.2.3 AND function 287
8.2.4 OR function 287
8.2.5 Exclusive OR function . 288
8.2.6 Combined binary logic operations, negating result of logic operation 288
8.2.7 T branch 289
8.2.8 Edge evaluation of binary tags 289
8.2.9 Comparison functions . 290
8.3 Programming standard boxes with FBD 291
8.3.1 Assign box . 291
8.3.2 Set and reset boxes . 292
8.3.3 Standard boxes with time response 293
8.3.4 Standard boxes with counter response . 294
8.4 Programming Q boxes with FBD . 294
8.4.1 Memory boxes . 295
8.4.2 Edge evaluation of result of logic operation 296
8.4.3 SIMATIC timer functions . 297
8.4.4 SIMATIC counter functions . 297
8.4.5 IEC timer functions . 298
8.4.6 IEC counter functions . 299
8.5 Programming EN/ENO boxes with FBD 300
8.5.1 Transfer function MOVE . 301
8.5.2 Arithmetic functions 302
8.5.3 Math functions . 303
8.5.4 Conversion functions . 303
8.5.5 Shift functions . 305
8.5.6 Word logic operations . 306Table of contents
14
8.6 Controlling the program flow with FBD . 307
8.6.1 Working with status bits in the function block diagram . 308
8.6.2 EN/ENO mechanism with FBD . 309
8.6.3 Jump functions . 310
8.6.4 Block functions . 312
8.6.5 Master Control Relay (MCR) 313
9 Statement list STL 315
9.1 Introduction 315
9.1.1 Programming with STL in general . 315
9.1.2 Structure of an STL statement 316
9.2 Programming binary logic operations with STL 317
9.2.1 Processing of a binary logic operation, operation step 317
9.2.2 Scanning for signal states “1” and “0” 319
9.2.3 Programming a binary logic operation in the statement list . 320
9.2.4 AND function 321
9.2.5 OR function 321
9.2.6 Exclusive OR function . 321
9.2.7 Combined binary logic operations 322
9.2.8 Control of result of logic operation 324
9.3 Programming memory functions with STL 325
9.3.1 Assignment 326
9.3.2 Setting and resetting . 326
9.3.3 Edge evaluation 327
9.4 Programming timer and counter functions with STL 328
9.4.1 SIMATIC timer functions 328
9.4.2 SIMATIC counter functions 330
9.4.3 IEC timer functions . 331
9.4.4 IEC counter functions . 332
9.5 Programming digital functions with STL . 333
9.5.1 Transfer functions 333
9.5.2 Comparison functions . 333
9.5.3 Arithmetic functions 337
9.5.4 Math functions . 340
9.5.5 Conversion functions . 341
9.5.6 Shift functions . 342
9.5.7 Word logic operations . 345
9.6 Controlling the program flow with STL . 347
9.6.1 Working with status bits in the statement list . 347
9.6.2 EN/ENO mechanism with STL . 349
9.6.3 Jump functions . 351
9.6.4 Jump list 352
9.6.5 Loop jump . 353
9.6.6 Block functions . 354
9.6.7 Master Control Relay (MCR) 356Table of contents
15
9.7 Further STL functions 358
9.7.1 Accumulator functions 358
9.7.2 Adding of constants to accumulator 1 360
9.7.3 Decrementing, incrementing . 361
9.7.4 Null instructions . 361
10 Structured Control Language SCL 363
10.1 Introduction to programming with SCL 363
10.1.1 Programming with SCL in general . 363
10.1.2 SCL statements and operators . 365
10.2 Programming binary logic operations with SCL 367
10.2.1 Scanning for signal states “1” and “0” . 367
10.2.2 AND function . 368
10.2.3 OR function . 369
10.2.4 Exclusive OR function 369
10.2.5 Combined binary logic operations . 369
10.2.6 Negating result of logic operation 370
10.3 Programming memory functions with SCL 370
10.3.1 Value assignment of a binary tag . 371
10.3.2 Setting and resetting 371
10.3.3 Edge evaluation . 371
10.4 Programming timer and counter functions with SCL . 372
10.4.1 SIMATIC timer functions . 372
10.4.2 SIMATIC counter functions . 373
10.4.3 IEC timer functions 374
10.4.4 IEC counter functions 375
10.5 Programming digital functions with SCL 375
10.5.1 Transfer function, value assignment of a digital tag . 376
10.5.2 Comparison functions 376
10.5.3 Arithmetic functions . 377
10.5.4 Math functions 378
10.5.5 Conversion functions 379
10.5.6 Shift functions 380
10.5.7 Word logic operations, logic expression . 381
10.6 Controlling the program flow with SCL 382
10.6.1 Working with the ENO tag . 382
10.6.2 EN/ENO mechanism with SCL . 383
10.6.3 Control statements 385
10.6.4 Block functions 394
11 S7-GRAPH sequential control 397
11.1 Introduction . 397
11.1.1 What is a sequential control? 397
11.1.2 Properties of a sequential control 398
11.1.3 Program for a sequential control, quantity framework 399
11.1.4 Operating modes 399Table of contents
16
11.1.5 Procedure for configuration . 400
11.2 Elements of a sequential control 400
11.2.1 Steps and transitions . 400
11.2.2 Jumps in a sequential control 402
11.2.3 Branching of a sequencer . 402
11.2.4 GRAPH-specific tags 403
11.2.5 Permanent instructions 404
11.2.6 Step and transition functions 405
11.2.7 Processing of actions . 408
11.3 Configuring a sequential control . 414
11.3.1 Programming the GRAPH function block 414
11.3.2 Configuring the sequencer structure . 415
11.3.3 Programming steps and transitions 417
11.3.4 Programming permanent instructions 418
11.3.5 Configuring block-independent alarms . 419
11.3.6 Attributes of the GRAPH function block . 419
11.3.7 Using the GRAPH function block . 420
11.4 Testing the sequential control 422
11.4.1 Loading the GRAPH function block . 422
11.4.2 Settings for program testing 422
11.4.3 Using operating modes . 423
11.4.4 Synchronization of a sequencer 424
11.4.5 Testing with program status . 425
12 Basic functions . 427
12.1 Binary logic operations 427
12.1.1 Introduction 427
12.1.2 Working with binary signals . 428
12.1.3 AND function, series connection . 431
12.1.4 OR function, parallel connection . 432
12.1.5 Exclusive OR function, non-equivalence function . 432
12.1.6 Negate result of logic operation, NOT contact 433
12.2 Memory functions 435
12.2.1 Introduction 435
12.2.2 Standard coil, assignment 435
12.2.3 Single setting and resetting . 436
12.2.4 Dominant setting and resetting, memory function . 437
12.2.5 Edge evaluation . 438
12.3 SIMATIC timer functions . 443
12.3.1 Overview . 443
12.3.2 Programming a timer function 444
12.3.3 Timer response as pulse 449
12.3.4 Timer response as extended pulse . 451
12.3.5 Timer response as ON delay . 453
12.3.6 Timer response as retentive ON delay 455
12.3.7 Timer response as OFF delay 457Table of contents
17
12.4 IEC timer functions . 459
12.4.1 Introduction 459
12.4.2 Pulse generation TP 459
12.4.3 ON delay TON . 460
12.4.4 OFF delay TOF 461
12.5 SIMATIC counter functions . 462
12.5.1 Overview . 462
12.5.2 Programming a counter function 463
12.5.3 Principle of operation of a counter function . 467
12.5.4 Enabling a counter function with STL . 468
12.6 IEC counter functions . 470
12.6.1 Introduction 470
12.6.2 Up counter CTU . 470
12.6.3 Down counter CTD . 471
12.6.4 Up/down counter CTUD . 472
13 Digital functions 475
13.1 General information 475
13.2 Transfer functions 476
13.2.1 General information on the “simple” transfer function 476
13.2.2 MOVE box with LAD and FBD 476
13.2.3 Loading and transferring with STL . 478
13.2.4 Value assignments with SCL . 479
13.2.5 Copying and filling a data area in the work memory 481
13.2.6 Transfer data area from and to load memory 483
13.2.7 Control memory area with MCR dependency . 485
13.3 Comparison functions 487
13.3.1 Execution of “simple” comparison function 488
13.3.2 Comparison function T_COMP . 488
13.3.3 Comparison function S_COMP . 490
13.4 Arithmetic functions 491
13.4.1 General function description 491
13.4.2 Data types and status bits for an arithmetic function 493
13.4.3 Execution of the arithmetic function . 494
13.4.4 Arithmetic functions for date and time . 495
13.5 Math functions . 496
13.5.1 General function description 496
13.5.2 General execution of a math function . 497
13.5.3 Trigonometric functions SIN, COS, TAN . 498
13.5.4 Arc functions ASIN, ACOS, ATAN . 499
13.5.5 Additional math functions 499
13.6 Conversion functions . 500
13.6.1 Implicit data type conversion 501
13.6.2 Data type conversion of fixed-point numbers 501
13.6.3 Data type conversion of floating-point numbers 505
13.6.4 Data type conversion for date/time with T_CONV . 507Table of contents
18
13.6.5 Data type conversion for data type STRING with S_CONV 509
13.6.6 Data type conversion of hexadecimal numbers . 510
13.6.7 Scaling and unscaling 511
13.6.8 Further conversion functions 513
13.7 Shift functions . 514
13.7.1 General function description 514
13.7.2 General execution of a shift function . 514
13.7.3 Shift to right 516
13.7.4 Shift to left . 517
13.7.5 Rotate to right . 518
13.7.6 Rotate to left 518
13.7.7 Rotating by the condition code bit CC1 (STL) . 519
13.8 Logic functions 519
13.8.1 Word logic operations 519
13.8.2 Invert 522
13.8.3 Code bit and set bit number . 523
13.8.4 Selection and limiting functions . 524
13.9 Functions for strings 526
14 Program flow control . 530
14.1 Status bits . 531
14.1.1 Description of the status bits 531
14.1.2 Controlling the status bits 533
14.1.3 Setting and resetting the result of logic operation 534
14.1.4 Controlling the binary result 535
14.1.5 Evaluating the status bits . 538
14.2 Jump functions 539
14.2.1 Introduction 539
14.2.2 Absolute jump 539
14.2.3 Conditional jump functions . 541
14.2.4 Jump functions depending on status bits 542
14.3 Block end functions . 545
14.3.1 Block end function RET (LAD and FBD) 545
14.3.2 Block end functions BEC, BEU, and BE (STL) 546
14.3.3 RETURN statement (SCL) . 546
14.4 Calling of code blocks . 547
14.4.1 General information on block calls . 547
14.4.2 Calling a function (FC) . 547
14.4.3 Calling a function block (FB) 549
14.4.4 Change to a block without block parameter 551
14.5 Data block functions 553
14.5.1 Open data block . 555
14.5.2 Additional data block functions with STL 555
14.5.3 Creating, deleting, and testing data blocks 556
14.6 Master control relay 560
14.6.1 Introduction 560Table of contents
19
14.6.2 MCR dependency 560
14.6.3 MCR area and MCR zone 560
14.6.4 MCR area and MCR zone with a block change 563
14.6.5 Instructions for the master control relay 563
15 Online operation and program test . 564
15.1 Connection of a programming device to the PLC station 565
15.1.1 Settings on the programming device . 565
15.1.2 Connecting the programming device to the PLC station . 566
15.1.3 Switching on online mode 566
15.2 Transferring project data 568
15.2.1 Loading project data for the first time 568
15.2.2 Reloading the project data 570
15.2.3 Protection of the user program 571
15.2.4 Editing of online project without offline project 572
15.2.5 Working with the Micro Memory Card 573
15.3 Working with blocks in online mode 574
15.3.1 Introduction 574
15.3.2 Editing the online version of a block 575
15.3.3 Downloading a block to the CPU . 575
15.3.4 Packing the work memory 577
15.3.5 Uploading blocks from the CPU 577
15.3.6 Working with setpoints . 579
15.3.7 Comparing blocks . 581
15.4 Hardware diagnostics . 583
15.4.1 Status displays on the modules 583
15.4.2 Diagnostic information . 584
15.4.3 Diagnostic buffer . 585
15.4.4 Diagnostic functions . 586
15.4.5 Online tools 586
15.4.6 Further diagnostic information via the programming device . 587
15.5 Testing the user program 588
15.5.1 Defining the call environment . 589
15.5.2 Testing with program status 589
15.5.3 Testing in single step mode . 593
15.5.4 Monitoring of PLC tags . 596
15.5.5 Monitoring of data tags . 596
15.5.6 Testing with watch tables . 597
15.5.7 Monitoring and modifying in the STOP operating state 602
15.5.8 Testing with the force table . 603
16 Distributed I/O 607
16.1 Introduction, overview 607
16.2 ET 200 distributed I/O system 608
16.2.1 ET 200M 608
16.2.2 ET 200MP 609Table of contents
20
16.2.3 ET 200S 609
16.2.4 ET 200SP . 610
16.2.5 ET 200iSP 611
16.2.6 ET 200pro 611
16.2.7 ET 200eco and ET 200eco PN 612
16.3 PROFINET IO . 613
16.3.1 PROFINET IO components . 613
16.3.2 Addresses with PROFINET IO 615
16.3.3 Special PROFINET configurations 618
16.3.4 Configuring PROFINET IO . 619
16.3.5 Coupling modules for PROFINET IO 623
16.3.6 Real-time communication in PROFINET . 624
16.4 PROFIBUS DP 628
16.4.1 PROFIBUS DP components 628
16.4.2 Addresses with PROFIBUS DP 632
16.4.3 Configuring PROFIBUS DP 635
16.4.4 Coupling modules for PROFIBUS DP 638
16.4.5 Special functions for PROFIBUS DP . 640
16.5 Isochronous mode 641
16.5.1 Introduction 641
16.5.2 Isochronous mode with PROFINET IO 641
16.5.3 Isochronous mode with PROFIBUS . 645
16.6 System blocks for distributed I/O . 648
16.6.1 System blocks for PROFIBUS DP 648
16.6.2 System blocks for PROFIBUS DP and PROFINET IO 652
16.6.3 System blocks for PROFINET IO 655
16.7 Actuator/sensor interface 657
16.7.1 Components of actuator/sensor interface 657
16.7.2 Addresses on the actuator/sensor interface 660
16.7.3 Configuring the actuator/sensor interface with CP 343-2P . 660
16.7.4 System functions for AS-i . 661
17 Communication 663
17.1 Overview 663
17.2 S7 basic communication . 664
17.2.1 Basics of station-internal S7 basic communication 664
17.2.2 Configuring of station-internal S7 basic communication 665
17.2.3 System blocks for station-internal S7 basic communication 665
17.2.4 Basics of station-external S7 basic communication . 667
17.2.5 Configuring of station-external S7 basic communication 668
17.2.6 System blocks for station-external S7 basic communication 668
17.3 S7 communication . 671
17.3.1 Basics 671
17.3.2 Configuring S7 communication . 671
17.3.3 One-way data exchange . 674Table of contents
21
17.3.4 Two-way data exchange . 675
17.3.5 Monitoring functions 678
17.4 Open user communication . 678
17.4.1 Basics 678
17.4.2 Establishing and clearing connections 680
17.4.3 Data transfer with TCP native or ISO-on-TCP . 682
17.4.4 Data transfer with UDP . 685
18 Appendix 687
18.1 Working with source files 687
18.1.1 General procedure . 687
18.1.2 Programming a code block in the source file . 688
18.1.3 Programming a data block in the source file . 692
18.1.4 Programming a PLC data type in the source file 695
18.2 Migrating projects 696
18.3 Simulation with the TIA Portal . 700
18.3.1 Differences from a real CPU . 700
18.3.2 Starting and saving the simulation . 701
18.3.3 Using the simulation . 702
18.3.4 Testing the program with the simulation 705
18.3.5 Additional functions of PLCSIM 707
18.4 Web server 707
18.4.1 Enable Web server . 707
18.4.2 Reading out Web information . 708
18.4.3 Standard Web pages . 709
18.5 Storage of local tags 712
18.5.1 Storage in global data blocks 712
18.5.2 Storage in instance data blocks 713
18.5.3 Storage in the temporary local data 713
18.5.4 Data storage of the block parameters of a function (FC) . 715
18.5.5 Data storage of the block parameters of a function block (FB) 717
18.5.6 Data storage of a local instance in a multi-instance . 718
Index
Index
A
Accumulator functions
(STL) 358
ACT_TINT (SFC 30) 189
Addition of constants
(STL) 360
AND function
Description 431
With FBD 287
With LAD 253
With SCL 368
With STL 321
ANY (parameter type) 136
ANY pointer
Structure 138
Variable SCL 140
Variable STL 139
Arithmetic functions
Description 491
With FBD 302
With LAD 269
With SCL 377
With STL 337
ARRAY (data type) 131
ASi_3422 (FC 7) 661
Assignment
Description 435
With FBD 291
With LAD 257
With SCL 371
With STL 326
Assignment list 244
Asynchronous errors
(OB 80 to OB 87) 206
ATH (FC94) 511
Authorization 31
B
BCD16 (data type) 123
BCD32 (data type) 123
Binary logic operations
Description 427
With FBD 285
With LAD 252
With SCL 367
With STL 317
Binary result
Control with SAVE 535
Save with FBD 308
Save with LAD 275
Save with STL 348
Status bit BR 533
Bit memory
addressing 97
Operand area 93
BLKMOV (SFC 20) 482
Block
Calling 165
Comparing 581
Compiling 239
Editing
FBD elements 284
LAD elements 251
SCL statement 365
STL statement 316
Know-how
protection 161
Nesting depth 154
Programming
Code block 223
Data block 236
General 223
Properties 158
Block calls
With FBD 313
With LAD 279
With SCL 395
With STL 354
BLOCK_xx (parameter
type) 135
BOOL (data type) 123
BRCV (FB 13) 677
BSEND (FB 12) 677
BYTE (data type) 123
C
C_CNTRL (FC 62) 678
Call structure 245
CAN_DINT (SFC 33) 192
CAN_TINT (SFC 29) 189
CASE (SCL) 387
CHAR (data type) 126
Clock memories 94
Communication
Open user
communication 678
S7 basic
communication 664
S7 communication 671
Communication error
(OB 87) 209
Comparison functions
Description 487
With FBD 290
With LAD 256
With SCL 376
With STL 333
CONCAT (FC 2) 528
Constants table 223
Contact
Comparison 256
Edge 255
NC contact 252
NO contact 252
CONTINUE (SCL) 391
Control statements
(SCL) 385
Controlling the program
flow
Description 530
With FBD 307
With LAD 274
With SCL 382
With STL 347
Conversion functions
Description 500
With FBD 303
With LAD 270
With SCL 379
With STL 341
COUNTER (parameter
type) 135
CREA_DBL (SFC 82) 558
CREAT_DB (SFC 22) 557
Cross-reference list 242
CTD down counter 471
CTU up counter 470
CTUD up/down counter 472
Cycle processing time 587
Cycle statistics 179Index
722
Cycle time monitoring 178
Cyclic interrupt
(OB 32 to OB 35) 193
D
D_ACT_DP (SFC 12) 654
Data
addressing 97
Operand area 94
Data block
Open
Description 555
With FBD 312
With LAD 279
With STL 355
Programming 236
Data types
Classification 120
Complex 128
Elementary 120
Parameter types 135
Pointer 136
DECO (FC 97) 523
Decrementing (STL) 361
DEL_DB (SFC 23) 559
DELETE (FC 4) 529
Dependency structure 246
Device name, device
number 86
Diagnostic address
General 75
With PROFIBUS DP 633
With PROFINET IO 617
Diagnostic buffer 585
Diagnostics interrupt
(OB 82) 211
Digital functions
Description 475
With FBD 300
With LAD 267
With SCL 375
With STL 333
DINT (data type) 123
DIS_AIRT (SFC 41) 210
DIS_IRT (SFC 39) 209
Distributed I/O
AS-Interface 657
PROFIBUS DP 628
PROFINET IO 613
DMSK_FLT (SFC 37) 205
DP_PRAL (SFC 7) 649
DP_TOPOL (SFC 103) 651
DPMRM_DG (SFC 13) 651
DPRD_DAT (SFC 14) 654
DPSYC_FR (SFC 11) 650
DPV1 interrupts
(OB 55 to OB 57) 196
DPWR_DAT (SFC 15) 655
DWORD (data type) 123
E
Edge evaluation
Description 438
With FBD 289, 296
With LAD 255, 262
With SCL 371
With STL 327
EN_AIRT (SFC 42) 211
EN_IRT (SFC 40) 210
EN/ENO mechanism
With FBD 309
With LAD 276
With SCL 383
With STL 349
Enable peripheral
outputs 602
ENCO (FC 96) 523
ENO (tag, SCL) 382
Error handling 200
ET 200 608
Exclusive OR function
Description 432
With FBD 288
With SCL 369
With STL 321
EXIT (SCL) 391
Expressions (SCL) 365
F
FILL (SFC 21) 483
FIND (FC 11) 528
First scan
Status bit 531
FOR (SCL) 388
Force table 603
G
Generation of absolute
value 513
GEO_LOG (SFC 71) 173
Geographic address
General 73
GET (FB 34) 675
GET_S (FB 14) 675
GETIO (FB 20) 653
GETIO_PA (FB 22) 653
H
Hardware diagnostics 583
Hardware interrupt
(OB 40) 195
HTA (FC 95) 511
I
I_ABORT (SFC 74) 666
I_GET (SFC 72) 665
I_PUT (SFC 73) 666
I/O access error
(OB 122) 201
IE communication
See open user communication
IEC counter functions
Description 470
With FBD 299
With LAD 266
With SCL 375
With STL 332
IEC timer functions
Description 459
With FBD 298
With LAD 265
With SCL 374
With STL 331
IF (SCL) 385
Incrementing (STL) 361
Inputs
addressing 97
Operand area 92
INSERT (FC 17) 529
Insert/remove module
interrupt
(OB 83) 207
INT (data type) 123
Interrupt processing
Cyclic interrupt 193
Delaying and
enabling 209
DPV1 interrupts 196
Hardware interrupt 195
Introduction 186
Isochronous mode
interrupt 197
Time-delay interrupt 191
Time-of-day
interrupt 188
Invert 522
IP_CONF (SFB 104) 657
Isochronous mode interrupt
(OB 61) 197Index
723
J
Jump functions
Description 539
With FBD 310
With LAD 277
With STL 351
Jump list (STL) 352
L
LEFT (FC 20) 528
LEN (FC 21) 528
Library
editing 45
LIMIT (FC 22) 525
Logic functions
Description 519
With FBD 306
With LAD 272
With SCL 381
With STL 345
Logical address 73
Loop jump 353
M
Main program
(OB 1) 176
Manufacturer interrupt
(OB 57) 196
Master Control Relay
Description 560
With FBD 313
With LAD 280
With STL 356
Math functions
Description 496
With FBD 303
With LAD 269
With SCL 378
With STL 340
MAX (FC 25) 525
Memory card 573
Memory functions
Description 435
With FBD 291, 295
With LAD 257, 261
With SCL 370
With STL 325
Memory reset 150, 586
Memory utilization
Offline 248
Online 584, 587
MID (FC 26) 528
MIN (FC 27) 525
Modules
addressing 73
parameterization 70
Status displays 583
MSK_FLT (SFC 36) 204
N
Negate RLO
With FBD 288
With LAD 255
With SCL 370
With STL 324
Nesting depth
Blocks 154
Normally closed contact
(LAD) 252
Normally open contact
(LAD) 252
Null instructions (STL) 361
Numerical range
overflow 532
O
OB 1 main program 176
OB 10 time-of-day
interrupt 188
OB 100 startup
program 171
OB 121 programming
error 201
OB 122 I/O access error 201
OB 2x time-delay
interrupt 191
OB 3x cyclic interrupt 193
OB 40 hardware
interrupt 195
OB 55 status interrupt 196
OB 56 update interrupt 196
OB 61 isochronous mode
interrupt 197
OB 80 time error 206
OB 82 diagnostics
interrupt 211
OB 83 Insert/remove module interrupt 207
OB 85 program execution
error 208
OB 86 rack failure 208
OB 87 communication
error 209
OB 57 manufacturer
interrupt 196
Online tools 586
Open user
communication 678
Operands 90
Operating state
RUN 149
STARTUP 147
STOP 146
Operation step (STL) 317
Operators (SCL) 365
OR function
Description 432
With FBD 287
With LAD 253
With SCL 369
With STL 321
Outputs
addressing 97
Operand area 92
Overflow
Status bit OS 532
Status bit OV 532
P
Parallel connection 253,
432
Peripheral inputs 91
Peripheral outputs 92
PLC station
adding 68
parameterization 70
PLC tag table 218
POINTER (parameter
type) 136
Priority classes 187
Process image
updating 177
PROFIBUS DP
addressing 632
Configuring 635
Direct data exchange 641
Isochronous mode 645
SYNC/FREEZE
groups 640
PROFINET IO
addressing 615
Configuring 619
Isochronous mode 641
Real-time
communication 624
SYNC domain 626
Topology editor 626
Program execution error
(OB 85) 208
Program execution
types 155Index
724
Program status 589
Programming error
(OB 121) 201
Project
archiving 44
editing 42
Object hierarchy 38
Reference project 44
PROTECT (SFC 109) 182
PRVREC (SFB 74) 656
PUT (FB 35) 675
PUT_S (FB 15) 675
Q
QRY_DINT (SFC 34) 192
QRY_TINT (SFC 31) 189
R
Rack failure (OB 86) 208
RALRM (SFB 54) 199
RCVREC (SFB 73) 656
RD_DPAR (SFB 81) 175
RD_LGADR (SFC 50) 173
RD_SINFO (SFC 6) 214
RD_SYS_T (SFC 1) 183
RDREC (SFB 52) 176
RDSYSST (SFC 51) 214
RE_TRIGR (SFC 43) 181
READ_DBL (SFC 83) 485
READ_ERR (SFC 38) 205
REAL (data type) 125
Reference project 44
REPEAT (SCL) 390
REPL_VAL (SFC 44) 205
REPLACE (FC 31) 529
RESET (FC 82) 487
RESETI (FC 100) 487
RESETP (SFC 80) 486
Result of logic operation
Status bit RLO 531
Retentive behavior 150
RLO
Reset (STL) 325
Set (STL) 325
RTM (SFC 101) 185
Runtime meter 184
S
S7 basic communication
Station-external 667
Station-internal 664
S7 communication 671
SALRM (SFB 75) 648
SAVE 535
SCALE (FC 105) 512
Scanning of signal state
With FBD 285
With LAD 252
With SCL 367
With STL 319
Scanning status bits
With FBD 308
With LAD 274
With STL 347
SEL (FC 36) 525
Series connection 253, 431
SET (FC 83) 487
SET_TINT (SFC 28) 189
SETI (FC 101) 487
SETIO (FB 21) 653
SETIO_PA (FB 23) 653
SETP (SFC 79) 486
Setting and resetting
Description 436
With FBD 292
With LAD 258
With SCL 371
With STL 326
Shift functions
Description 514
With FBD 305
With LAD 272
With SCL 380
With STL 342
SIMATIC counters
Description 462
With FBD 294, 297
With LAD 260, 264
With SCL 373
With STL 330
SIMATIC timers
Description 443
With FBD 293, 297
With LAD 260, 263
With SCL 372
With STL 328
Slot address 73
SRT_DINT (SFC 32) 192
Start information
Data type 143
Read out with
RD_SINFO 214
Startup program 171
Status bits
Description 531
Evaluate 538
Status bit /FC 531
Status bit OR 532
Status bit OS 532
Status bit OV 532
Status bit RLO 531
Status bits CC0 and
CC1 533
Status STA 532
Status interrupt
(OB 55) 196
Status word 533
STEP 7
Portal view 32
Project view 33
STP (SFC 46) 181
STRING (data type) 129
STRING functions 526
STRUCT (data type) 133
Symbol table
See PLC tag table
SYNC_PI (SFC 126) 198
SYNC_PO (SFC 127) 198
SYNC/FREEZE 640
Synchronous error (OB 121
and OB 122) 201
System time 184
T
T branch
With FBD 289
With LAD 254
T_ADD (FC 1) 496
T_COMBINE (FC 3) 496
T_CONV 507
T_DIFF (FC 34) 496
T_SUB (FC 35) 496
TADDR_PAR (UDT 66) 686
Tag tables
See watch tables
Tags
Control 600
Declaring data tags 239
Forcing 603
Introduction 90
Monitoring with PLC tag
table 596
Monitoring with watch
table 599
PLC tag table 218
TCON (FB 65) 680
TCON_PAR (UDT 65) 682
TDISCON (FB 66) 681
TEST_DB (SFC 24) 559
Time
Configuring 182
Setting online 183
TIME (data type) 127
Time error (OB 80) 206Index
725
TIME_TCK (SFC 64) 184
Time-delay interrupt
(OB 20, OB 21) 191
Time-of-day interrupt
(OB 10) 188
TIMER (parameter
type) 135
Timer response
Extended pulse 451
OFF delay 457
ON delay 453
Pulse 449
Retentive ON delay 455
TOF OFF delay 461
TON ON delay 460
TP pulse generation 459
Transfer functions
Description 476
With FBD 301
With LAD 268
With SCL 376
With STL 333
TRCV (FB 64) 684
TSEND (FB 63) 682
TURCV (FB 68) 685
TUSEND (FB 67) 685
Two’s complement 513
U
UBLKMOV (SFC 81) 482
UNSCALE (FC 106) 512
Update interrupt
(OB 56) 196
URCV (FB 29) 676
URCV_S (FB 9) 676
USEND (FB 28) 676
USEND_S (FB 8) 676
User data 92
User program
Cycle monitoring
time 178
Cycle processing
time 587
Error handling 200
Loading 568
Process image 177
Programming
With FBD 282
With LAD 249
With SCL 363
With STL 315
Protecting 182
Response time 179
Testing with program
status 589
Testing with watch
tables 597
V
VOID (parameter type) 136
W
WAIT (SFC 47) 181
Warm restart 147
Watch tables 597
WHILE (SCL) 390
WORD (data type) 123
Word logic operations
Description 519
With FBD 306
With LAD 272
With SCL 381
With STL 345
WR_SYS_T (SFC 0) 183
WR_USMSG (SFC 52) 215
WRIT_DBL (SFC 84) 485
WRREC (SFB 53) 176
WWW (SFC 99) 712
X
X_ABORT (SFC 69) 671
X_GET (SFC 67) 670
X_PUT (SFC 68) 671
X_RCV (SFC 66) 670
X_SEND (SFC 65) 669
كلمة سر فك الضغط : books-world.net
The Unzip Password : books-world.net
تحميل
يجب عليك التسجيل في الموقع لكي تتمكن من التحميل
تسجيل | تسجيل الدخول