Sunteți pe pagina 1din 11

Josef Weigmann, Gerhard Kilian

Decentralizatio
n with
PROFIBUS
DP/DPV1
Structure, configuration and use of
PROFIBUS DP with SIMATIC S7

SIEMENS

Weigmann/Kilian Decentralization with PROFIBUS DP/DPV1

Bibliographie infonpation published by Die Deutsche Bibliothek


Die Deutsche Bibliothek lists this publication in the Deutsche Nationalbibliografie; detailed
bibliographic data is available in the Internet at http://dnb.ddb.de

Although the publisher and authors have prepared this book with great
care, errors cannot be excluded. Liability will not be accepted by the
publisher or the authors regardless of the legal ground.
The designations used in this book may be trademarks the use of which by third parties for their own
purposes may violate the rights of the owner.

ISBN 3-89578-218-1
Editor: Siemens Aktiengesellschaft, Berlin and Munich
Publisher: Publicis Corporate Publishing, Erlangen
Publicis KommunikationsAgentur GmbH, GWA Erlangen, 2003
This publication and all parts thereof are protected by copyright. All rights reserved.
Any use of it outside the strict provisions of the copyright law without the consent of
the publisher is forbidden and will incur penalties. This applies particularly to
reproduction, translation, microfilming or other processing, and to storage or
processing in electronic systems. It also applies to the use of extracts from the text.
Printed in German
y

Preface

In the last decade, rapid progress in the decentralized architecture of automated industrial plants
and processes has made fieldbus systems increasingly popular. The reason for this development is
obvious: installing I/O channels where they are actually needed - in the vicinity of the machine reduces installation and wiring work to a minimum. Significant cost savings are the result.

Standardized fieldbus systems with open communications interfaces enable the use of distributed
inputs/outputs and also of intelligent, process signal-conditioning field devices from different
manufacturers.

The architecture of a fieldbus system must be both transparent and open. These are important
aspects for automation engineers when they have to depide which fieldbus to choose from among
the wide range of components now available on th market.

With its bus access procedure, PROFIBUS meets the important demand for data accessibility on the
field level of the industrial plant. On the one hand it covers the communication re quirements in the
sensor/actuator area, and on the other hand all networking functions for the so-called cell area.
Particularly in the area of distributed I/O, PROFIBUS has become a de facto internationally
accepted standard with a large selection of connectable field devices.

This book describes PROFIBUS (PROcessFIeldBUS), an open fieldbus system that complies with
the EN (EuropaNorm) standard, Volume 2 [1]/IEC 61158 [10], and whose protocol has been
specialized for decentralized peripherals (DP). We have written this book with the goal of making it
as easy as possible for system engineers, programmers and commissioning engineers to familiarize
themselves with the subject and implement automation tasks with PROFIBUS DP. The use of
PROFIBUS DP/DPV1 is illustrated by many example projects based on the SIMATIC S7
automation system and STEP 7 Version

5.1 SP3.

In this second, revised, and updated edition, new interrupts and user program interfaces in the
SIMATIC S7 are introduced with regard to the DPV1 expansion.

While it is advisable that you have a basic knowledge of the SIMATIC S7-300 and SIMATIC S7400 programmable controllers and the STL (statement list) programming language, this is not an
essential requirement.
Josef Weigmann, Gerhard Kilia

Contents

Erlangen, July 2003

PROFIBUS Fundamentals................................ ....................................13

1.1
1.2
1.2.1
1.2.2
1.2.3

ISO/OSI Model....................................................................................................13
Architecture and Versions of the Protocol...........................................................14
PROFIBUS DP....................................................................................................15
PROFIBUS FMS.................................................................................................15
PROFIBUS PA....................................................................................................15

1.3
1.3.1

1.3.5

PROFIBUS Layer................................................................................................16
Physical
Layer (Layer 1) for DP/FMS (RS 485)................................................................ 16
Physical
Layer (Layer 1) for DP/FMS (Fiber Optic Cable)...............................................19
Physical
Layer (Layer 1) for PA.........................................................................................21
Fieldbus
Data Link (Layer 2).............................................................................................23
Application Layer (Layer 7)................................................................................25

1.4
1.4.1
1.4.2
1.4.3

Bus Topology.......................................................................................................27
RS 485 ............................................................................................................... 27
Fiber Optics.........................................................................................................29
Topology acc. to IEC 1158-2 (PROFIBUS PA)...................................................30

1.5
1.5.1
1.5.2

Bus Access Control in a PROFIBUS Network....................................................31


Token Bus Procedure...........................................................................................32
Master-Slave Procedure.......................................................................................33

1.6

Bus Parameters....................................................................................................33

1.3.2
1.3.3
1.3.4

Types of Bus Devices and Data Communication

with PROFIBUS DP.......................................................................................35


2.1
2.1.1
2.1.2
2.1.3
2.1.4

Types of Bus Devices..........................................................................................37


DP Master (Class 1).............................................................................................37
DP Slave..............................................................................................................37
DP Master (Class 2).............................................................................................37
DP Combination Devices.....................................................................................38

2.2
2.2.1
2.2.2

Data Communication between the Various Types of DP Devices........................38


DP Communication Relationships and DP Data Exchange.................................38
Initialization Phase, Restait and User Data Communication...............................39

2.3
2.3.1
2.3.2

PROFIBUS DP Cycle..........................................................................................43
Setup of a PROFIBUS DP Cycle.........................................................................43
Setup of a Constant PROFIBUS DP Cycle..........................................................44

2.4
2.4.1
2.4.2

Data Exchange by means of Cross Communication............................................44


Master-Slave Relationship with Cross Communication......................................45
Slave-Slave Relationship with Cross Communication........................................46

2.5

DPV1 Functional Expansions.............................................................................46

PROFIBUS DP in SIMATIC S7 Systems..............................................48

3.1
3.2
3.2.1
3.2.2

PROFIBUS DP Interfaces in SIMATIC S7 Systems...........................................48


Other Communication Functions Using DP Interfaces........................................57
S7 Functions........................................................................................................57
FDL Services.......................................................................................................57

3.3
3.3.1
3.3.2
3.3.3
3.3.4
3.3.5
3.3.6
3.3.7
3.3.8

System Response of the DP Interfaces in SIMATIC S7 Controllers.....................58


Startup Behavior of DP Master Interfaces in the SIMATIC S7...........................58
Failure/Recovery of DP Slave Stations................................................................58
Insert/Remove Interrupt for DP Slave Stations....................................................58
Diagnostic Interrupts Generated by DP Slave Stations........................................59
Process Interrupts Generated by DP Slave Stations................. ..........................59
Status Interrupt of DP Slave Stations...................................................................59
Update Interrupt of DP Slave Stations.................................................................59
Vendor-Specific Interrupt of DP Slave Stations...................................................60

3.4
DP Slave Types in SIMATIC S7 Systems.............................................................60
3.4.1 Compact DP Slaves.............................................................................................60

3.4.2
3.4.3

Modular DP Slaves..............................................................................................60
Intelligent Slaves (I Slaves).................................................................................61

Programming and Configuring PROFIBUS DP with STEP 7...........62

4.1
4.2
4.2.1
4.2.2
4.2.3
4.2.4
4.2.5
5
5.1
5.1.1
5.1.2
5.1.3
5.2
5.2.1
5.2.2
5.2.3
5.2.4
5.2.5
5.2.6
5.2.7
5.2.8
5.2.9
5.2.10
5.3
5.3.1
5.3.2
5.3.3
5.4
5.4.1
5.4.2
5.4.3
5.4.4
5.4.5
5.4.6
5.4.7
5.5
5.5.1
5.5.2

STEP 7 Fundamentals..........................................................................................63
Example Project with PROFIBUS DP.................................................................64
Creating a New STEP 7 Project...........................................................................65
Inserting Objects in the STEP 7 Project...............................................................65
PROFIBUS Network Settings.............................................................................66
Configuring the Hardware Using the HW Config Program.................................72
Configuring DP Slaves........................................................................................74
DP User Program Interfaces...................................................................................83
Basics of DP User Program Interfaces................................................................ 83
Organization Blocks (OBs).....................................................................................83
DP-Related System Functions (SFCs)....................................................................84
Basics of SIMATIC S7 Data Records.....................................................................87
Organization Blocks................................................................................................89
Cyclically Processed Main Program (OBI).............................................................89
Process Interrupts (OB40 to OB47).................................................................. 90
Status Interrupt (OB55)..........................................................................................91
Update Interrupt (OB56).........................................................................................91
Vendor-Specific Interrupt (OB57)...........................................................................92
Diagnostic Interrupts (OB82).................................................................................93
Insert/Remove Module Interrupts (OB83)..............................................................95
Program Sequence Error (OB85)............................................................................97
Rack Failure (OB86)...............................................................................................99
I/O Access Error (OB 122)................................................................................ 103
DP User Data Communication and Process Interrupt Functions........................ 104
Exchange of Consistent DP Data with SFC14 DPRD_DAT
and SFC15 DPWRJDAT.................................................................................... 104
Control Commands SYNC and FREEZE Transmitted with
SFC11 DPSYC_FR............................................................................................. 106
Triggering a Process Interrupt on the DP Master with SFC7 DP_PRAL . . . . 110
Reading DP Diagnostic Data.............................................................................. 112
Reading the Standard Diagnostic Data of a DP Slave with
SFC13 DPNRM_DG.......................................................................................... 112
Interrupt from a DP Slave Received with SFB54 RALRM................................113
DP-Related System State List (SZL)................................................................. 120
Layout of a System Status Sublist..................................................................... 121
Reading System Status Sublists with SFC51 RDSYSST.................................... 121
Available System Status Sublists....................................................................... 124
Special Features of SFC51 RDSYSST................................................................ 125
Reading and Writing Data Records/Parameters................................................. 125
Writing Dynamic Parameters with SFC55 WR_PARM...................................... 125
Writing a Predefined Data Record/Parameter from the SDB with
SFC56 WRJDPARM........................................................................................... 128

5.5.3
5.5.4
5.5.5
5.5.6
5.5.7

Writing All Predefined Data Records/Parameters from the SDB with


SFC57 PARM_MOD.......................................................................................... 129
Writing a Data Record/Parameter with SFC58 WRJREC..................................130
Reading Data Record with SFC59 RD_REC..................................................... 133
Read Data Set with SFB52 RDREC................................................................... 134
Write Data Set with SFB53 WDREC................................................................. 135

Example Projects for Data Communication with

7.................................................PROFIBUS DP....................................
...................................................141
7.1

Data Communication with I/O Access Commands............................................ 141

7.2

Exchanging Consistent Data with SFC14 DPRDJDAT


and SFC15 DPWRJDAT..................................................................................... 143
7.2.1 User Program for I-Slave (S7-300 with CPU315-2DP).....................................144
7.2.2 User Program for DP Master (S7-400 with CPU416-2DP)...............................147
7.2.3 Testing the Data Exchange between DP Master and I Slave..............................148
7.3
7.3.1
7.3.2

Handling Process Interrupts.............................................................................. 149


Generating Process Interrupts on the I Slave (S7-300)...................................... 149
Processing Process Interrupts on the DP Master (S7-400)................................. 151

7.4
7.4.1

Transferring Data Records and Parameters........................................................


Layout of the Data Record (DR1) for the Analog Input Modules
of SIMATIC S7-300 ..........................................................................................
Example: Changing the Parameters of Analog Input Modules Using
SFC55 WRJPARM..............................................................................................
Testing the Parameters for the Analog Input Module Changed with
SFC55 WR_PARM..............................................................................................
User Program for Changing the Parameter Set for the Analog Input
Module Using SFC56 WRJDPARM....................................................................
Testing the Parameters for the Analog Input Module Changed with
SFC56 WR_DPARM...........................................................................................

7.4.2
7.4.3
7.4.4
7.4.5

152
153
155
157
157
158

7.5
7.5.1
7.5.2

Triggering the DP Control Commands SYNC/FREEZE...................................158


Example of SYNC/FREEZE with DP Master IM 467 ...................................... 160
Generating the User Program for the SYNC/FREEZE Function.......................165

7.6
7.6.1

Exchanging Data Using Cross Communication................................................. 168


Example Project for Cross Communication with I Slaves (CPU 315-2DP). . . 168

Diagnostic Functions for PROFIBUS DP...........................................179

8.1

Diagnosis by means of LEDs on the SIMATIC S7 CPUs,


the DP Master Interfaces and the DP Slaves....................................................... 180
8.1.1 LEDs of the S7-300........................................................................................... 180
8.1.2 LEDs of the S7-400 CPUs Equipped with a DP Interface................................. 182
8.1.3 LEDs of the DP Slaves.............. ....................................................................... 184
8.2
Diagnosis by means of Online Functions of the STEP 7 Program..................... 185
8.2.1 Display Accessible Nodes in SIMATIC Manager...............................................185
8.2.2 ONLINE, Function in SIMATIC Manager......................................................... 189
8.2.3 Module Information in SIMATIC Manager....................................................... 190
8.2.4 Diagnose Hardware in SIMATIC Manager...................................................... 196
8.3
Diagnosis by means of the User Program.......................................................... 198
8.3.1 DP-Slave Diagnosis Using SFC13 DPNRM_DG.............................................. 199
8.3.2 Diagnosis Using SFC51 RDSYSST in OB82..................................................... 201
8.3.3 Diagnostics Using SFB54 RALRM....................................................................203
8.4
8.4.1
8.5
8.6
8.6.1
8.6.2
8.6.3

Diagnosis Using the SIMATIC S7 Diagnostic Block FB125 ........................... 205


Diagnostic Block FB 125 .................................................................................. 206
Diagnosis Using a PROFIBUS Bus Monitor.....................................................207
Diagnostics with the Diagnostic Repeater.........................................................209
Determining the Topology............................................ ...................................210
Tracing Faults....................................................................................................211
Requirements for Operating the Diagnostic Repeater.......................................212

Setting Up and Commissioning a PROFIBUS DP System................214

9.1
9.1.1
9.1.2
9.1.3
9.1.4

Tips on Setting Up a PROFIBUS DP System....................................................214


System Setup with Grounded Reference Potential............................................214
System Setup with Ungrounded Reference Potential........................................216
Installing the PROFIBUS Cable........................................................................216
Shielding the PROFIBUS Cable........................................................................217

9.2
Tips on the Initial Start-Up of a PROFIBUS DP System...................................217
9.2.1 Bus Cables and Bus Plug Connectors................................................................217
9.2.2 Checking the PROFIBUS Bus Cable and the Bus Plug Connectors..................217
9.2.3 Bus Termination.................................................................................................221
9.3
9.3.1
9.3.2
9.3.3
9.3.4
9.3.5

BT 200 Test Device for the Bus Physics of PROFIBUS DP.............................221


Wiring Test........................................................................................................222
Station Test (RS 485)......................................................................................... 222
Branch Test........................................................................................................223
Distance Measurement.......................................................................................223
Reflection Test...................................................................................................223

9.4

Signal Test of the DP Inputs and Outputs...........................................................224

10

Other DP-Related STEP 7 Functions..................................................226

10.1 GSD Files..........................................................................................................226


10.1.1 Installing a New GSD File.................................................................................226
10.1.2 Importing a Station GSD File............................................................................226
10.2

Assigning and Changing the PROFIBUS Address............................................227

10.3

NETPRO...........................................................................................................228
10.4 PG Online Functions.......... . ............................................................229
10.5 NCM Diagnostics....................................................................................229

Glossary........................................................................................................................ 231
Abbreviation.................................................................................................................244
Standards and Regulation...........................................................................................247
Index 248

S-ar putea să vă placă și