Você está na página 1de 38

Functions for User Manual

SIMATIC S7-300 and S7-400


Net Data Transfer with
SIMOREG and SIMOVERT Drives
via PROFIBUS-DP
________________________________________________________________

Ausgabe / Edition 12.97 Bestell-Nr. / Order No. E20125-C0010-S302-A1-7600


The reproduction, transmission or use of this document or its
contents is not permitted without express written authority.
Offenders will be liable for damages. All rights, including rights
created by patent grant or registration of a utility model or
design, are reserved.

We have checked that the contents of this document


correspond to the hardware and software described.
Nonetheless, differences might exist and therefore we cannot USS is a trademark of Siemens.
guarantee that they are completely identical. The information
SIMOREG is a trademark of Siemens.
contained in this document is, however, reviewed regularly and
any necessary changes will be included in the next edition. We SIMOVERT is a trademark of Siemens.
welcome suggestions for improvement. SIMATIC is a trademark of Siemens.

 Siemens AG 1997 All Rights Reserved


Contents, Editions, References

Contents

1 INTRODUCTION.................................................................................................................................................. 1
1.1 GENERAL INFORMATION ................................................................................................................................... 1
1.2 REQUIREMENTS ............................................................................................................................................... 1
1.2.1 Hardware................................................................................................................................................. 1
1.2.2 Software .................................................................................................................................................. 1
1.3 INSTALLATION NOTES ....................................................................................................................................... 1
1.4 BLOCK FUNCTIONS ........................................................................................................................................... 1
1.5 PARAMETER PROCESS DATA OBJECT (PPO) ..................................................................................................... 1
2 CONFIGURATION OF COMMUNICATION ........................................................................................................ 3
2.1 PARAMETERIZATION OF THE DP INTERFACE ...................................................................................................... 3
2.3 PARAMETERIZATION OF THE DRIVES.................................................................................................................. 5
3 DESCRIPTION OF THE BLOCKS ...................................................................................................................... 6
3.1 BLOCK STRUCTURE .......................................................................................................................................... 6
3.2 FUNCTIONS ..................................................................................................................................................... 7
3.2.1 FC21: DPS7-S (transmit) ........................................................................................................................ 7
3.2.2 FC22: DPS7-E (receive) ......................................................................................................................... 8
3.2.3 FC23: DPS7-V (pre-assignment) .......................................................................................................... 10
3.3 DATA BLOCKS ................................................................................................................................................ 12
3.3.1 DB "net data" (communication interface) .............................................................................................. 12
3.3.2 DB "parameter sets".............................................................................................................................. 20
4 TECHNICAL DATA AND PROCESSING TIMES .............................................................................................. 22
4.1 TECHNICAL BLOCK DATA................................................................................................................................. 23
4.2 PROCESSING TIMES ....................................................................................................................................... 23
5 DIAGNOSTICS .................................................................................................................................................. 24
5.1 DP DIAGNOSTICS ........................................................................................................................................... 24
5.2 S7 SYSTEM DIAGNOSTICS............................................................................................................................... 24
6 EXAMPLE PROGRAM ...................................................................................................................................... 25
6.1 BUS CONFIGURATION AND BUS INTERFACE ...................................................................................................... 25
6.2 PARAMETERIZATION OF THE DP INTERFACE .................................................................................................... 27
6.3 PLC PROGRAM .............................................................................................................................................. 27
6.4 PROGRAM LISTING ......................................................................................................................................... 28
6.5 PARAMETERIZATION OF THE DRIVES................................................................................................................ 31
7 ABBREVIATIONS.............................................................................................................................................. 32

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 I
Contents, Editions, References

Editions
Edition Order Number Date Status

First edition E20125-C0010-S302-A1-7600 December 1997 Published

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


II E20125-C0010-S302-A1-7600
Contents, Editions, References

Note

This specification does not purport to cover all details or variations in equipment, nor to provide for every
possible contingency to be met in connection with installation, operation or maintenance.
Should further information be desired or should particular problems arise which are not covered
sufficiently for the purchaser's purposes, the matter should be referred to your local Siemens Sales
Office.

The contents of this specification shall not become part of or modify any prior or existing agreement,
commitment or relationship. The sales contract contains the entire obligation of the Variable-Speed Drives
Division of Siemens AG. The warranty contained in the contract between the two parties is the sole
warranty of Variable-Speed Drives Division. Any statements made in this documentation/specification
neither create new warranties nor modify the existing warranty.

References
/1/: SIMATIC S7
System Software for S7-300/400
Reference Manual
Order No.: C79000-G7000-C303-01
/2/: SIMOVERT Master Drives
Communication Board CB1
Operating Instructions
Order No.: 6SE7087-6CX84-0AK0
/3/: SIMOREG K 6RA24
Communication Board CB24
Operating Instructions
Order No.: 6RX1241-0AK01
/4/: SIMOVERT MASTERDRIVES Motion Control
Kompendium, Chapter 8.2
Order No.: 6SE7080-0QX50
/5/: PROFIBUS-Profil Drehzahlveränderbare Antriebe, PROFIDRIVE
PROFIBUS-Nutzerorganisation Karlsruhe
Order No. 3.071

Files: All documents prepared using Winword 7.0.

DPS7-1b.doc Title page without picture


DPS7-2b.doc This document: Copyright, Table of Contents, Editions, References
DPS7-3b.doc Contents
DPS7-4b.doc Last page

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 III
User Manual

1 Introduction
1.1 General information
The "DVA_S7 option package for SIMATIC S7" supports communications links between SIMOREG and
SIMOVERT variable-speed drives and a higher-level SIMATIC S7 control system. The link is implemented using
the standardized PROFIBUS-DP communications system in accordance with the "PROFIBUS profile variable-
speed drives, PROFIDRIVE" /5/ or via the Universal Serial Interface Protocol
(the USS protocol).
This Manual describes the STEP7 user program required for profile-compliant net data transfer between a
SIMATIC S7-300 or S7-400 as the master and drives as slaves on the PROFIBUS-DP bus system.
The software in question is part of the "DVA_S7 option package for SIMATIC S7" and is to be found in the
STEP7 library "DPS7".

1.2 Requirements
1.2.1 Hardware
• PC/PG with a Pentium 133MHz and at least 16MB RAM
• S7-CPU 3xx/4xx with at least 12KB RAM and integrated PROFIBUS-DP interface or S7-CPU 4xx with at
least 12 KB RAM and CP443-5

1.2.2 Software
• Windows95 / Windows NT (V4.0 or higher)
• STEP 7 Version 3.x or higher
• DVA_S7-DPS7
• Type files: In STEP 7 versions < 4.02 the type description files already integrated in STEP 7 for the
configuration of communications modules CB1 and CB24 (SI8022AX.200 and SI802DAX.200) must be
updated with the type description files of the same name on the DVA_S7-CD.

1.3 Installation notes


To start the installation, please insert the DVA_S7-CD in the CD-ROM drive of your PG/PC and start the
SETUP.EXE program. You will receive all further information during installation.

1.4 Block functions


One or several data blocks (DB "net data") form the user interface for net data exchange between the PLC
program and the drives. Two functions (FC 21, FC 22) are available for sending and receiving these net data.
These blocks extract the parameter set required to process the individual slaves from their own data block (DB
"parameter sets").
Another function (FC 23) supports set-up and pre-assignment of the data blocks required for communication.
Its features are:
• Creation of data areas for communication depending on the bus configuration.
• Pre-assignment of the DB "parameter sets"
• Net data exchange can be parameterized according to the 5 defined PPO types (see 1.5).
• Execution and monitoring of PKW requests.
• Handling of parameter change reports.

1.5 Parameter process data object (PPO)


Five parameter process data objects (PPO types) have been defined for transmission of net data in the
"PROFIBUS profile for speed-variable drives, PROFIDRIVE".
Depending on the PPO type, the net data have a PZD area for process data and a PKW area for parameter
processing.
The PKW area allows the master to read and write parameter values and the slave to signal parameter changes
in the form of parameter change reports.
The PZD area contains signals necessary for process control, such as control words and setpoints from the
master to the slave and status words and actual values from the slave to the master.
The net data structure of the PPOs is described in detail in /2/, /3/ and /4/.
Different net PPO types can be selected for the different nodes on the bus (slaves). But this makes it more
difficult to write the communication program.

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 1
User Manual

2 Configuration of communication
Before starting up PROFIBUS communication, it is necessary to work through the following configuration steps:
• Define hardware configuration, parameterize DP master and slaves (STEP 7 hardware configuration)
• Parameterize communication software "DPS7"
− Create data blocks
− Pre-assign data block "parameter sets"
− Write the communication program
• Parameterize the drives

2.1 Parameterization of the DP interface


The DP interface is parameterized during hardware configuration in STEP7.
When you select a CPU with integrated DP interface or a DP communications processor from the hardware
catalog of STEP 7, a PROFIBUS-DP system is provided in the hardware configuration. Once the parameters of
the master (eg, baud rate) have been set, the slaves must be selected from the hardware catalog and placed in
the PROFIBUS line.
Station number, PPO type and I/O addresses must be parameterized for the slaves. (See 6.2 for example.)

Note: If PPO types 2 or 5 are selected in the set configuration for communications modules CB1 and CB24
the entries given under "options" must be used. The same applies to module CBP if this module is
not configured as a standard slave with expanded functionality in STEP 7.

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


2 E20125-C0010-S302-A1-7600
User Manual

2.2 Parameterization of the communication software and troubleshooting

No
Hardware configuration in STEP 7 End
completed?
Yes

No
Same PPO type for all slaves?
Yes

Data of the slaves contiguous in No


the DBND?

Yes

Create data blocks DBND and DBPA with Create data blocks DBND and DBPA manually
FC23 and pre-assign DBPA: and pre-assign DBPA manually:
• Call up and parameterize FC23 in • Calculate length of DBND and create "empty"
OB100 → 3.2.3 DBND → 3.3.1 (possibly take over example DB
from LIBRARY → 4)
• Calculate length of DBPA, create and pre-
assign DBPA → 3.3.2 (possibly take over
example DB from LIBRARY → 4)

Call and parameterize FC21/22 once per slave in the cyclic


program of the current

Load hardware configuration and user program into the PLC

No
BUSF display on the CPU off? Check bus link to the slaves
Does the number of slaves on the bus correspond
with the hardware configuration?
Yes
Check bus addresses

Restart the PLC

Yes
Communication in progress? End

No
No
CPU in STOP? Check parameterization of the drives
Check content of the net data (actual values being
received? Is bit 10 set in the control word?)
Yes Evaluate communication status word in DBND →
3.3.1

Read out module status of the CPU


Evaluate diagnostic buffer of the CPU
If FC23 is called up in the program: Check status byte ANZ → 3.2.3
Check Pafe1-/Pafe2-byte in DBND → 3.3.1
Check system/slave parameters in DBPA → 3.3.2

2.3 Parameterization of the drives

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 3
User Manual

The drives are linked to the PROFIBUS-DP via supplementary modules or interface modules in the drives.
These are
• Communication board CB1 or CBP for MASTERDRIVES FC, VC with CU2 and SC
• Communication board CBP for MASTERDRIVES Motion Control, Vector Control with CUVC and SIMOREG
DC MASTER
• Communication board CB24 for SIMOREG K 6RA24
• Interface module OPMP for MICRO-/MIDIMASTER 6SE31
• Interface module CB15 for MICRO-/MIDIMASTER 6SE32
• Interface module CB155 for COMBIMASTER.

See the relevant module or device instruction manual for parameterization of these interfaces in the units.
Please see Section 6.5 for examples.

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


4 E20125-C0010-S302-A1-7600
User Manual

3 Description of the blocks


3.1 Block structure

OB "start-up" FC: DPS7-V


DB "net data"

SANZ Commnication

TNU1 control slave 1

PPO Transmit
DBND slave 1

DBPA Receive
WDH slave 1
PANF
ANZ :

FC: DPS7-S DB "parameter sets"


OB "cycle"
DBPA
SYPA
System parameters
SLPA

Communication
parameter set
FC: DPS7-E
slaves 1...n
DBPA
SYPA
SLPA

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 5
User Manual

3.2 Functions

3.2.1 FC21: DPS7-S (transmit)


The transmit block (FC: DPS7-S) handles transmission of the net data (PZD and any PKW data) to the slave
depending on the PPO type used.
It extracts the parameter set of the current slave from the DB "parameter sets" and reads its transmit data from
the DB "net data". After evaluation of the communication control word (initiates a PKW request or acknowledges
a parameter change report), FC: DPS7-S completes the transmit data and transfers them consistently into the
output I/O area of the CPU using the S7 system function SFC15. If the block detects a parameterization error in
the DB "parameter sets", an error signal is stored in the Pafe 2-byte of the DB "net data".

Program structure
DB "net data"

Communication
control slave 1
OB "cycle"
Transmit
slave 1

FC: DPS7-S Receive


slave 1
DBPA
SYPA :
SLPA
DB "parameter sets"

System parameters

Communication
parameter set
slaves 1...n

Call
FC21 must be called at least once per PLC cycle and slave.

STL
CALL FC 21
DBPA :=
SYPA :=
SLPA :=

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


6 E20125-C0010-S302-A1-7600
User Manual

Explanation of the inputs and outputs (parameters) of the FC21


Name Decl Type Designation Comment

DBPA in INT Block number of the DB "parameter Permissible parameterization:


sets" depends on CPU

CPU 315-2DP: 1 - 127


CPU 413-2DP: 1 - 511
CPU 414-2DP: 1 - 1023
CPU 416-2DP: 1 - 4095
Permissible parameterization:
SYPA in INT Initial address of the "system
parameters" in DB "parameter sets"
0 - 8172
SLPA in INT Initial address of the parameters Permissible parameterization:
assigned to the current slave in
0 - 8180
DB "parameter sets"

3.2.2 FC22: DPS7-E (receive)


The receive block (FC: DPS7-E) handles receipt of the net data (PZD and any PKW data) from the slave
depending on the PPO type used.
It extracts the parameter set of the current slave from DB "parameter sets". Using the S7 function SFC14 it
transfers the receive data from the input I/O area of the CPU to the receive area of the DB "net data". FC: DPS7-
E evaluates the received data (PKW request complete, drive fault etc.) and updates the communication status
word in DB "net data" on the basis of this evaluation. If the module detects a parameterization error in DB
"parameter sets", an error signal is put in Pafe 1-byte of DB "net data".

Program structure
DB "net data"

Communication
control slave 1
OB "cycle"
Transmit
slave 1

FC: DPS7-E Receive


slave 1
DBPA
SYPA :
SLPA

DB "parameter sets"

System parameters

Communication
parameter set
slaves 1...n

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 7
User Manual

Call
FC22 must be called at least once per PLC cycle and slave.

STL
CALL FC 22
DBPA :=
SYPA :=
SLPA :=

Explanation of the inputs and outputs (parameters) of the FC22


Name Decl Type Designation Comment

DBPA in INT Block number of the DB "parameter Permissible parameterization:


sets" depends on CPU

CPU 315-2DP: 1 - 127


CPU 413-2DP: 1 - 511
CPU 414-2DP: 1 - 1023
CPU 416-2DP: 1 - 4095
Permissible parameterization:
SYPA in INT Initial address of the "system
parameters" in DB "parameter sets"
0 - 8172
SLPA in INT Initial address of the parameters Permissible parameterization:
assigned to the current slave in
0 - 8180
DB "parameter sets"

The parameters of the FC: DPS7-E correspond to the parameters of the FC: DPS7-S.
The two functions FC21 and FC22 access the same parameter set in DB "parameter sets" (system parameters
and slave communication parameters) for one slave and must therefore be parameterized identically for one
slave.

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


8 E20125-C0010-S302-A1-7600
User Manual

3.2.3 FC23: DPS7-V (pre-assignment)

The FC: DPS7-V is an optional function.


Using this FC, it is possible to generate the data blocks "net data" and "parameter sets" required for
communication on S7 system start-up. The DBPA is also pre-assigned. The FC: DPS7-V is suitable for the
generation and pre-assignment of the specified data areas if all the slaves have the same PPO type.
When called up, the FC first checks the plausibility of its parameterization for the number of slaves, PPO type,
number of start nodes, I/O addresses and PKW repetitions. If the block detects an error, generation and pre-
assignment of the data blocks is not performed or is canceled. The CPU goes into the STOP state and the user
receives an error signal via the error byte of the FC: DPS7-V. After the parameterization error has been
corrected, any data blocks already generated must be deleted before a restart.
After the plausibility check, the block checks whether the data blocks to be generated already exist:
• If not, they are generated and the DBPA is pre-assigned.
• If they do, the length of each data block is checked. If the DB is long enough, the DB "parameter sets" is pre-
assigned again and the content of DB "net data" is deleted. If a DB is too short, the CPU goes into the STOP
state. The user can recognize the DB with the error by the status byte of the FC: DPS7-V. To correct the
error, the two data blocks must be deleted completely. They are then generated again on the next restart and
DB "parameter sets" is pre-assigned.
The FC: DPS7-V allocates the station numbers for the following slaves in contiguous ascending order starting
from the initial node number (TNU1) for the number of given slaves (parameter SANZ). The I/O addresses for
communication between the master and slaves is derived from the PPO type and parameter PANF (initial
address for PKW and PZD slaves must be identical for the same slave!). Finally, the FC calculates the location
of the slave data in DB "net data" (addresses of communication control words KSTW) and enters the resulting
parameters in DB "parameter sets".

Limit values
The DP address space available in a SIMATIC S7 depends on the CPU but is always at least 2048 bytes (4
Kbytes for CPU414-2DP, 416-2DP).
FC23 performs its calculations on the basis of maximum 2048 bytes available address space. With FC23 and
the following limit values:
• DP address space maximum 2048 bytes,
• Maximum 125 slaves in a DP system (limited to 123 slaves if FC23 is used)
• Different maximum number of DP slaves in the different S7 DP master systems
the following number of drives can be parameterized:

Number of drives Number of drives actually possible


PPO type theoretically possible
CPU315-2DP CPU414-2DP CP443-5 Ext.
CPU413-2DP CPU416-2DP
1 170 64 96 123
2 102 64 96 102
3 512 64 96 123
4 170 64 96 123
5 73 64 73 73
Values applicable in 1/98!

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 9
User Manual

Call
FC23 is called up during system start-up (OB100).

STL
CALL FC 23
SANZ :=
TNU1 :=
PPO :=
DBND :=
DBPA :=
WDH :=
PANF :=
ANZ :=

Explanation of the inputs and outputs (parameters) of the FC23


Name Decl Type Designation Comment

SANZ in INT Number of slaves with the same Permissible value: 1 to 64


PPO type
TNU1 in INT Initial node (station) Permissible value: 3 to 125
number
PPO in INT Parameter process data object type Permissible value: 1 to 5
DBND in INT DB "net data" Block number for net data

CPU 315-2DP: 1 - 127


CPU 413-2DP: 1 - 511
CPU 414-2DP: 1 - 1023
CPU 416-2DP: 1 - 4095
DBPA in INT DB "parameter sets" Block number for DB "parameter sets"

CPU 315-2DP: 1 - 127


CPU 413-2DP: 1 - 511
CPU 414-2DP: 1 - 1023
CPU 416-2DP: 1 - 4095
WDH in INT Repetitions Number of repetitions of PKW request
PANF in INT I/O information Initial byte of DP address space
ANZ out BYTE Error byte 0: No error
1: Number of slaves <= 0
2: Wrong PPO type
3: DB "parameter sets" too short
4: DB "net data" too short
5: Error station number
6: I/O area not sufficient
7: Repeat counter: incorrect value

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


10 E20125-C0010-S302-A1-7600
User Manual

3.3 Data blocks


The functions FC21 and FC22 work with the data blocks "net data" (DBND) and "parameter sets" (DBPA).
These data blocks can either be generated and pre-assigned with the FC: DPS7-V during CPU start-up (DBPA
only) or entered manually. The DVA_S7 library "DPS7" contains sample data blocks DBPA and DBND in the
path "LIBRARY" with comments for all PPO types.

3.3.1 DB "net data" (communication interface)


The DB "net data" is the interface between the communication and the control program. The user must provide
this block "empty" and with sufficient length. The transmit data for a slave only have to be entered in the transmit
buffer of the DBND assigned to the slave from the control program. The response data of the slave are taken
from the appropriate receive buffer. Status words allow communication to be checked and the control word
permits initiation of a specific parameterization request.
The communication interface contains the following data for each slave:
• Slave related communication data (communication control, tracing, 5 data words)
• Buffer for the current PKW request (only with PPO 1, 2 and 5; 4 data words)
• Transmit buffer for PPO data (PPO 1-5; 2 to 14 data words)
• Receive buffer for PPO data (PPO 1-5; 2 to 14 data words)

The length of the transmit and receive buffers must depend on the PPO type. If the PKW interface does not exist
(PPO types 3 and 4), the buffer for the current PKW request is not used. DBW0 is reserved.
The length of the DB "net data" required depends on the number of slaves and the PPO type used: As the
maximum length of a data block in the SIMATIC S7 depends on the CPU used, several "net data" DBs may be
necessary in certain cases.

Number of data words per slave in DB "net data" = 2 x (PKW + PZD) + PKW +5
where PKW = 0 or 4
PZD = 2, 6 or 10.

Value table:
PPO type Number of data Number of data words in the Number of data words in the DBND
words per slave in DBND dependent on number of where
the DBND slaves n nmax = 125* and same PPO type
1 21 n x 21 + 1 2626
2 29 n x 29 + 1 3626
3 9 nx9+1 1126
4 17 n x 17 + 1 2126
5 37 n x 37 + 1 4626
* Reduction of maximum number of slaves used on PROFIBUS-DP possible by limiting the number of DP slaves on an S7
(see 3.2.3)!

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 11
User Manual

Assignment of DB "net data" for a slave using PPO type 1

DBW n Communication control word (KSTW) Communication control *


DBW n+2 Internal
DBW n+4 Communication status word Communication tracing *
DBW n+6 Internal PKW attempt counter
DBW n+8 Pafe 1-byte, Pafe 2-byte Parameterizing error
DBW n+10 Parameter ID PKE
DBW n+12 Index IND Buffer for current
DBW n+14 Parameter value 1 PWE1 PKW request
DBW n+16 Parameter value 2 PWE2
DBW n+18 Parameter ID PKE
DBW n+20 Index IND PKW area
DBW n+22 Parameter value 1 PWE1
DBW n+24 Parameter value 2 PWE2 Transmit buffer *
DBW n+26 Control word (STW) PZD1 PZD area
DBW n+28 Main setpoint (HSW) PZD2
DBW n+30 Parameter ID PKE
DBW n+32 Index IND PKW area
DBW n+34 Parameter value 1 PWE1
DBW n+36 Parameter value 2 PWE2 Receive buffer*
DBW n+38 Status word (ZSW) PZD1 PZD area
DBW n+40 Main actual value (HIW) PZD2

(n = 2,4,6...)

All areas and data words marked * must be assigned and evaluated by the user.

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


12 E20125-C0010-S302-A1-7600
User Manual

Assignment of DB "net data" for a slave using PPO type 2

DBW n Communication control word (KSTW) Communication control *


DBW n+2 Internal
DBW n+4 Communication status word Communication tracing *
DBW n+6 Internal PKW attempt counter
DBW n+8 Pafe 1-byte, Pafe 2-byte Parameterizing error
DBW n+10 Parameter ID PKE
DBW n+12 Index IND Buffer for current
DBW n+14 Parameter value 1 PWE1 PKW request
DBW n+16 Parameter value 2 PWE2
DBW n+18 Parameter ID PKE
DBW n+20 Index IND PKW area
DBW n+22 Parameter value 1 PWE1
DBW n+24 Parameter value 2 PWE2
DBW n+26 Control word (STW) PZD1 Transmit buffer *
DBW n+28 Main setpoint (HSW) PZD2
DBW n+30 Setpoint / suppl. control word PZD3
DBW n+32 Setpoint / suppl. control word PZD4 PZD area
DBW n+34 Setpoint / suppl. control word PZD5
DBW n+36 Setpoint / suppl. control word PZD6
DBW n+38 Parameter ID PKE
DBW n+40 Index IND PKW area
DBW n+42 Parameter value 1 PWE1
DBW n+44 Parameter value 2 PWE2
DBW n+46 Status word (ZSW) PZD1 Receive buffer*
DBW n+48 Main actual value (HIW) PZD2
DBW n+50 Actual value / suppl. status word PZD3
DBW n+52 Actual value / suppl. status word PZD4 PZD area
DBW n+54 Actual value / suppl. status word PZD5
DBW n+56 Actual value / suppl. status word PZD6

(n = 2,4,6...)

All areas and data words marked * must be assigned and evaluated by the user.

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 13
User Manual

Assignment of DB "net data" for a slave using PPO type 3

DBW n Communication control word (KSTW)


DBW n+2 Internal
DBW n+4 Communication status word Communication tracing *
DBW n+6 Internal
DBW n+8 Pafe 1-byte, Pafe 2-byte Parameterizing error
DBW n+10 Control word (STW) PZD1 Transmit buffer *
DBW n+12 Main setpoint (HSW) PZD2
DBW n+14 Status word (ZSW) PZD1 Receive buffer*
DBW n+16 Main actual value (HIW) PZD2

(n = 2,4,6...)

Assignment of DB "net data" for a slave using PPO type 4

DBW n Communication control word (KSTW)


DBW n+2 Internal
DBW n+4 Communication status word Communication tracing *
DBW n+6 Internal
DBW n+8 Pafe 1-byte, Pafe 2-byte Parameterizing error
DBW n+10 Control word (STW) PZD1
DBW n+12 Main setpoint (HSW) PZD2
DBW n+14 Setpoint / suppl. control word PZD3 Transmit buffer *
DBW n+16 Setpoint / suppl. control word PZD4
DBW n+18 Setpoint / suppl. control word PZD5
DBW n+20 Setpoint / suppl. control word PZD6
DBW n+22 Status word (ZSW) PZD1
DBW n+24 Main actual value (HIW) PZD2
DBW n+26 Actual value / suppl. status word PZD3 Receive buffer*
DBW n+28 Actual value / suppl. status word PZD4
DBW n+30 Actual value / suppl. status word PZD5
DBW n+32 Actual value / suppl. status word PZD6

(n = 2,4,6...)

All areas and data words marked * must be assigned and evaluated by the user.

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


14 E20125-C0010-S302-A1-7600
User Manual

Assignment of DB "net data" for a slave using PPO type 5

DBW n Communication control word (KSTW) Communication control *


DBW n+2 Internal
DBW n+4 Communication status word Communication tracing *
DBW n+6 Internal PKW attempt counter
DBW n+8 Pafe 1-byte, Pafe 2-byte Parameterizing error
DBW n+10 Parameter ID PKE
DBW n+12 Index IND Buffer for current
DBW n+14 Parameter value 1 PWE1 PKW request
DBW n+16 Parameter value 2 PWE2
DBW n+18 Parameter ID PKE
DBW n+20 Index IND PKW area
DBW n+22 Parameter value 1 PWE1
DBW n+24 Parameter value 2 PWE2
DBW n+26 Control word (STW) PZD1
DBW n+28 Main setpoint (HSW) PZD2
DBW n+30 Setpoint / suppl. control word PZD3 Transmit buffer *
DBW n+32 Setpoint / suppl. control word PZD4
DBW n+34 Setpoint / suppl. control word PZD5
DBW n+36 Setpoint / suppl. control word PZD6 PZD area
DBW n+38 Setpoint / suppl. control word PZD7
DBW n+40 Setpoint / suppl. control word PZD8
DBW n+42 Setpoint / suppl. control word PZD9
DBW n+44 Setpoint / suppl. control word PZD10
DBW n+46 Parameter ID PKE
DBW n+48 Index IND PKW area
DBW n+50 Parameter value 1 PWE1
DBW n+52 Parameter value 2 PWE2
DBW n+54 Status word (ZSW) PZD1
DBW n+56 Main actual value (HIW) PZD2
DBW n+58 Actual value / suppl. status word PZD3 Receive buffer*
DBW n+60 Actual value / suppl. status word PZD4
DBW n+62 Actual value / suppl. status word PZD5
DBW n+64 Actual value / suppl. status word PZD6 PZD area
DBW n+66 Actual value / suppl. status word PZD7
DBW n+68 Actual value / suppl. status word PZD8
DBW n+70 Actual value / suppl. status word PZD9
DBW n+72 Actual value / suppl. status wordPZD10
(n = 2,4,6...)
All areas and data words marked * must be assigned and evaluated by the user.

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 15
User Manual

Structure of the communication control word KSTW (DBW n)

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Bit 0 = 0 Do not accept PKW request


= 1 Accept PKW request

Bit 1 = 0 No meaning
= 1 Accept parameter change report

Structure of the communication status word (DBW n+4)

15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0

Bit 0 = 0 No PKW request/PKW request channel free


= 1 PKW request in progress

Bit 1 = 0 No meaning
= 1 PKW request complete without error

Bit 2 = 0 No meaning
= 1 PKW request complete with error

Bit 3 = not used

Bit 4 = 0 PKW interface (to the drive) without error


= 1 PKW interface with error (counter overflow)

Bit 5 = 0 Response data do not contain parameter change report


= 1 Response data contains a parameter change report

Bit 6 = 0 Drive without operation fault


= 1 Operation fault in drive

Bit 7 = 0 No warning
= 1 Warning from drive pending

Bit 8 = 0 Local drive operation or PLC has taken over PZD control
= 1 PLC control requested (PZD)

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


16 E20125-C0010-S302-A1-7600
User Manual

Handling of communication control word, status word, PAFE bytes and PKE by the user

Communication control word


Bit 0: Initiation of the PKW request
Set: By the user, if a new PKW request is in the transmit buffer awaiting processing.
Reset: By the FC: DPS7-S, if the PKW request has been accepted.

Bit 1: Acknowledgment of a pending parameter change report


Set: By the user, once he has accepted the parameter change report.
Reset: By the FC: DPS7-S after acceptance of the acknowledgment.
The slave resumes interrupted processing of the current request after this acknowledgment
or transmits the next parameter change report.

Communication status word


Bit 0: PKW request in progress
Set: By the FC: DPS7-S, if the PKW request has been accepted and the parameter ID (PKE)
contains a valid request ID.
Reset: By the FC: DPS7-E, if a PKW request has been executed (with or without error) or
if the PKW interface has an error.

Bit 1: PKW request complete without error


Set: By the FC: DPS7-E, if a PKW request has been executed correctly. The
response is taken from the receive buffer.
Reset: By the FC: DPS7-S, if a new PKW request is initiated.

Bit 2: PKW request completed with error


Set: By the FC: DPS7-E for response ID "7" in the PKE. The error number is in the PWE
of the slave response.
Reset: By the FC: DPS7-S, if a new PKW request is initiated.

Bit 3: Not used

Bit 4: PKW interface with error (counter overflow)


Set: By the FC: DPS7-E, if the PKW request is not acknowledged by the slave within a
parameterized number of request repetitions (parameter "WDH" in DB "parameter sets") or for
response ID "8" in the PKE.
Reset: By the FC: DPS7-E, if a new PKW request is initiated and executed properly.

Bit 5: Response data contain parameter change report


Set: By the FC: DPS7-E, if a parameter change report from the slave is pending (response ID 9 to 12
and toggle bit 11 inverted).
Reset: By the FC: DPS7-S, if the user has acknowledged the parameter change report (communication
control word, Bit 1).

Bit 6: Operation fault in drive


Set/
Reset: By the FC: DPS7-E. The FC evaluates the status word (Bit 3) from the slave.

Bit 7: Warning from the drive is pending


Set/
Reset: By the FC: DPS7-E. The FC evaluates the status word (Bit 7) from the slave.

Bit 8: PLC control requested


Set/ By the FC: DPS7-E. The FC evaluates the status word (Bit 9) and the control word
Reset: (bit 10).

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 17
User Manual

Note on Bit 2 and 4 of the communication status word:


The PKW request last transferred by the user is retained in the transmit interface after it has been processed.
Transmission to the slave is repeated until a new request is entered. This might require additional responses in
the user program in the event of the statuses "PKW request completed with error" (bit 2) and "PKW interface
fault" (bit 4).

Pafe 1-byte (DBBn+9)


Error signal from FC: DPS7-E, parameterization error in DB "parameter sets"
Value = 2: wrong PPO type

Pafe 2-byte (DBBn+8)


Error signal from FC: DPS7-S, parameterization error in DB "parameter sets"
Value = 2: wrong PPO type

Parameter ID PKE in transmit buffer (DBW n+18; required for PPO types 1, 2 and 5 only)
The user must assign values to the parameter number (bits 0 to 10) and the request ID (bits 12 to 15) (for
request and response IDs see /2/ and /3/). The toggle bit (bit 11) for the parameter change report is masked by
functions FC21, 22.

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


18 E20125-C0010-S302-A1-7600
User Manual

3.3.2 DB "parameter sets"


The DB "parameter sets" contains the program parameters required for controlling communication. The user
must create this block and assign the configuration of the communication system accordingly (FC23 or
manually).
The length of the DB "parameter sets" depends on the number n of slaves in the bus system. 6 data words are
required for each slave, 1 data word is assigned once for the system parameters. DBW0, 2 and 4 are reserved.
For a maximum of 125 slaves on the PROFIBUS-DP the DB "parameter sets" is 1506 words long.

Assignment of the DB "parameter sets"

DBW 0 Not used


DBW 2 Not used System parameters
DBW 4 Not used (per DP master)
DBW 6 WDH
DBW 8 PPO
DBW 10 TNU
DBW 12 DBND Communication
DBW 14 KSTW parameter set slave 1
DBW 16 PPKW
DBW 18 PPZD
DBW 20 PPO
DBW 22 TNU
DBW 24 DBND Communication
DBW 26 KSTW parameter set slave 2
DBW 28 PPKW
DBW 30 PPZD
• •
• •

PPO
TNU
DBND Communication
KSTW parameter set slave n
PPKW
DBW (n x 12 PPZD
+ 6)

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 19
User Manual

Parameter description

System parameters

WDH: Number of permissible repetitions of a PKW request


Permissible values: 0 to 32767
If the initiated PKW request is not completed within the set number, the PKW interface is
signaled as faulted (see Description "Communication status word").

Slave communication parameter set

PPO: Parameter process data object type


Permissible values: 1 to 5
Any differences from this are detected as parameterization errors by FC: DPS7-S and FC:
DPS7-E recognized as parameterization error and signaled to DB "net data" (Pafe 1-byte, Pafe
2-byte).

TNU: Node number, corresponds to the DP station number defined with STEP7 (hardware
configuration). Permissible values: 1 to 125

DBND: Block number of the DB "net data"


CPU 315-2DP: 1 - 127
CPU 413-2DP: 1 - 511
CPU 414-2DP: 1 - 1023
CPU 416-2DP: 1 - 4095

KSTW: Address of the communication control word KSTW for the slave in DB "net data".

PPKW: Initial address of the DP I/O area for the PKW data of the slave (I/O address as defined in the
STEP 7 hardware configuration for this slave). The content of this parameter is of no
consequence for PPO types 3 and 4!

PPZD Initial address of the DP I/O area for the PZD data of the slave (I/O address as defined in the
STEP 7 hardware configuration for this slave).
Note on PPKW and PPZD:
If the DBPA is pre-assigned manually, the addresses of the I/O area for the PKW and PZD data
of a slave do not have to be contiguous. If the DBPA is pre-assigned with FC23, however, the
program assumes this.

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


20 E20125-C0010-S302-A1-7600
User Manual

4 Technical data and processing times


The DPS7 library is subdivided into two paths:
• The LIBRARY path contains all blocks for creation of the communication program and example data blocks
"parameter sets" (DB11 to 15) and "net data" (DB111 to 115) with comments for all PPO types.
• Path EXAMPLE300+400 contains a complete example program for S7-300/400 with an integrated DP
interface.
The numbers of the blocks can be changed.

Structure of the library:

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 21
User Manual

4.1 Technical block data

Technical data STEP7 library DPS7

Block number FC 21 FC 22 FC 23

Block name DPS7-S DPS7-E DPS7-V

Version number 02.00 02.00 02.00

Written in language STL STL STL

Lengths Block 1980 2922 1662


[bytes]

MC7 code 1716 2532 1436

Local data 110 120 64

Call lengths Block 50 50 102

[bytes] MC7 code 50 50 102

Local data 8 8 16

Nesting depth 1 1 1

Called blocks SFC15 - DPRD_DAT SFC14 - DPWR_DAT SFC21 - FILL


SFC22 - CREAT_DB
SFC46 - STOP

Assigned flags, None None None


timers, counters

Assignment of data blocks DB "net data" DB "net data" DB "net data"


DB "parameter sets" DB "parameter sets" DB "parameter sets"
DB "CP" DB "CP" DB "CP"

4.2 Processing times


The cycle time for communication with a drive in the SIMATIC S7 is composed of the processing time of the
block pair FC21/FC22 and the runtimes of SFC 14/15 called by these blocks (exception: PPO type 3 does not
require an SFC call!). The SFC runtimes depend on the CPU type and version used.

Processing time for one drive (TSFC = runtime of a SFC)


FC 21 + FC 22 CPU 315-2DP CPU 413-2DP CPU 414-2DP

PPO3 1.5 ms 0.5 ms 0.25 ms


PPO1,4 1.5 ms + 2xTSFC 0.5 ms +2xTSFC 0.25 ms + 2xTSFC
PPO2,5 1.5 ms + 4xTSFC 0.5 ms +4xTSFC 0.25 ms + 4xTSFC

Examples: Processing time for 5 slaves, baud rate 12 Mbit/s


CPU315-2DP (TSFC: 180µs): PPO3 → 7.5 ms PPO1,4 → 9.3 ms PPO2,5 → 11.1 ms
CPU414-2DP (TSFC: 155µs): PPO3 → 1.25 ms PPO1,4 → 2.8 ms PPO2,5 → 4.4 ms

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


22 E20125-C0010-S302-A1-7600
User Manual

5 Diagnostics

5.1 DP diagnostics
DP diagnostics is not included in the functions of the "option package DVA_S7 for SIMATIC S7" and must
therefore be programmed by the user. System function SFC13 ( "DPNRM_DG") is available for reading out slave
diagnostics data and is explained in /1/.
Program example /6/ demonstrates parameterization of SFC13 (FC99).

5.2 S7 system diagnostics


SIMATIC S7 signals the following slave errors irrespective of the communication board used in the drives:
• If a DP station fails OB86 (subrack failure) is called
• OB122 is called on a direct I/O access error.

Communication boards CBP, CB15 and CB155 also support the diagnostic alarm function of the S7. In the event
a drive fault, a diagnostic alarm is triggered and OB82 in the CPU is called .

A defined response to an error can therefore be programmed in these organization blocks. The block in question
must always be "empty" in the PLC. Otherwise the CPU goes into the STOP state if an error occurs.

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 23
User Manual

6 Example program
The program example for the SIMATIC S7 S7-300/400 PLC with integrated DP interface is located in path
EXAMPLE300+400 of library DPS7.
The numbers of the blocks can be changed.

6.1 Bus configuration and bus interface

The example program is based on the following bus configuration:

Master
CPU
315-2DP
4xx-2DP

SINEC L2 bus cable

CBx CBx

MASTER MASTER
DRIVES DRIVES

Slave 1 Slave 2

Bus cable
• The bus is implemented in RS485 technology with a shielded twisted-pair cable.
The SIEMENS SINEC L2 bus cable (order no.: 6XV1830-0AH10) can be used as the bus cable.
• The bus cable must be laid in such a way that it is as free as possible from interference.

Bus termination
The first and last nodes must be fitted with a terminating resistor.

Equipotential bonding
An equipotential bonding conductor must be laid between the nodes.
2 2
(16 mm copper cable for lengths up to 200m, 25 mm copper cable for lengths above 200m).

Bus connector on the SIMATIC S7

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


24 E20125-C0010-S302-A1-7600
User Manual

For connection to the S7-DP master (integrated DP interface or separate CP), a 9-way subminiature D
connector is required (eg, SINEC L2 bus connector SIEMENS 6ES7972-0BA10-0XA0).

Switch position = Off


Terminating resistor disconnected

Off

B = RS485P = pin 3
BABA A = RS485N = pin 8

The cable shield (12mm)


must be bare and contact
the metal guide

Bus cable from Bus cable to


one node the next node

Bus interface on MASTERDRIVES with CB1


Screw/clamp-type terminal X148 on the CB1 (matching Phoenix terminal supplied with CB1 module)
X148 Assignment
1
2 B line, receive/transmit data P from previous node
3 A line, receive/transmit data N from previous node
4 B line, receive/transmit data P to next node
5 A line, receive/transmit data N to next node
6
Note: A-A and B-B are not jumpered in the connector! If you do not want removal of a connector from the DP
module on one slave to result in disconnection of the next slaves from the bus, both A lines must be connected
to a common terminal (3 or 5) and both B lines must be connected to a common terminal (2 or 4).

Terminate the bus (only necessary if the drive is the first or last node):
DIP-FIX switch S1 Function
S1.3 Jumper closed: Bus termination
S1.4 Jumper closed: Bus termination

Note: The position of jumpers S1.3 and S1.4 must only be changed when the electronic box is disconnected
from the power supply. The terminating resistor draws power from the connected unit. Therefore, make sure
that the units (CB1) at the end of the bus are always supplied with power (each must have a separate electronic
power supply!)

Bus interface on MASTERDRIVES with CBP


9-way subminiature D connector X448 (use SINEC L2 bus connector as for SIMATIC S7, see above)
X448 Assignment
1
2
3 B line, receive/transmit data P
4
5
6
7
8 A line, receive/transmit data N
9
Terminate the bus (only necessary if the drive is the first or last node):
Via switch in SINEC L2 bus connector.

6.2 Parameterization of the DP interface

The DP interface is parameterized as part of the hardware configuration in STEP7.

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 25
User Manual

Selecting a CPU with integrated DP interface or a DP communications processor from the hardware catalog of
STEP 7 implements a PROFIBUS-DP system in the hardware configuration. Once the parameters of the master
(eg, baud rate) have been set, slave 1 and slave 2 must be selected from the hardware catalog and placed in the
PROFIBUS line.
Station number, PPO type and I/O addresses must be parameterized for both slaves as follows.

Slave 1
MASTERDRIVES CB1 or CBP
Station number: 3
PPO type 1
Inputs: IW 256 (4 words PKW) Outputs: QW 256 (4 words PKW)
IW 264 (2 words PZD) QW 264 (2 words PZD)
Slave 2
MASTERDRIVES CB1 or CBP
Station number: 4
PPO type 1
Inputs: IW 268 (4 words PKW) Outputs: QW 268 (4 words PKW)
IW 276 (2 words PZD) QW 276 (2 words PZD)

The DP system is now parameterized for the program example and the data for the hardware configuration can
be loaded in the CPU.

6.3 PLC program

The example program from library path EXAMPLE300+400 can be loaded directly into the CPU memory.
The example provides the following functions:
• Generation of DB "net data" and DB "parameter sets".
• Pre-assignment of the DB "parameter sets"
• Net data exchange with 2 drives via PPO type 1.
• Handling of parameter requests (1 read and 2 write requests for MASTERDRIVES VC with CU2).
• Read out of DP diagnostic data.

The following definitions apply:


• The system parameters are in DB50, DBW0 to DBW8 (DB "parameter sets").
• Drive 1 (MASTERDRIVES VC with CU2, communication board CB1 or CBP):
Station number 3
I/O addresses PW256 to PW266 (Caution: Default setting in hardware configuration for
S7-400 = PW512; addresses must be adapted!)
Slave communication parameters in DB 50, DBW 8 to DBW 18 (DB "parameter sets").
Communication interface in DB 100, DBW 2 to DBW 42 (DB "net data").
• Drive 2 (MASTERDRIVES VC with CU2, communication board CB1 or CBP):
Station number 4
I/O addresses PW 268 to PW 278.
Slave communication parameters in DB 50, DBW 20 to DBW 30 (DB "parameter sets").
Communication interface DB 100, DBW 44 to DBW 84 (DB "net data").

In the example, the following S7 blocks are used:


OB1: Cyclic program
OB82: Diagnostic alarm
OB86: Subrack failure
OB100: Start-up
OB122: I/O access error

FC21, 22, 23: Blocks DPS7-S, -E, -V


FC99: Read-out of slave diagnostic data of slaves 1 and 2 with SFC13 (DPNRM_DG)
FC100: Initiate PKW requests for slaves 1 and 2

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


26 E20125-C0010-S302-A1-7600
User Manual

DB50: DB "parameter sets" for slaves 1 and 2 (system and slave related parameters for slaves 1 & 2)
DB99: DB for read diagnostic data of slaves 1 and 2
DB100: DB "net data" (communication interface for slaves 1 and 2)

In the example, the following flags are used:


M 10.0: Initiate "read diagnostic data"
M 10.1: Identifier: Read out of diagnostic data not yet complete
MB 50: Error flag for slaves 1 and 2 after execution of FC23
MB 100: Initiation bits for PKW requests to slave 1 (MASTERDRIVES VC with CU2)
M100.0: P462, change index = 1, value = 50 (ramp-up time = 5s)
M100.1: value of parameter 462, read index = 1
M100.2: P469, change index = 1, value = 50 (rounding HLG = 50%).
MB 101: Initiation bits for PKW requests to slave 2 (MASTERDRIVES VC with CU2)
M101.0: P462, change index = 1, value = 50 (ramp-up time = 5s)
M101.1: value of parameter 462, read index = 1
M101.2: P469, change index = 1, value = 50 (rounding HLG = 50%).2

6.4 Program listing

OB100 : Start-up
Example program for 2 DP slaves
Network 1: Create data blocks DBPA and DBND and pre-assign DBPA
CALL FC 23
SANZ :=2 // Number of slaves
TNU1 :=3 // Node number of the first slave
PPO :=1 // PPO type
DBND :=100 // Number of the (first) DB "net data"
DBPA :=50 // Number of DB "parameter sets"
WDH :=100 // Number of repetitions PKW request
PANF :=256 // I/O beginning (see STEP7 hardware configuration)
ANZ :=MB50 // Error byte
OPN DB 100 // DB "net data" slave 1 and 2
L W#16#45E
T DBW 28 // Control word slave 1
T DBW 70 // Control word slave 2
BE

OB1: Cyclic program


Example program for 2 DP slaves
Network 1 : Read the first 6 bytes of diagnostic data
CALL FC 99 // Read diagnostic data

Network 2 : Transmit initiation for PKW requests to slaves 1 and 2


CALL FC 100 // Start PKW requests

Network 3 : Call send DP


CALL FC 21 // ***** SLAVE 1 *****
DBPA :=50 // Number of DB "parameter sets" (DBPA)
SYPA :=0 // Beginning of system parameters in DBPA
SLPA :=8 // Beginning of slave parameters in DBPA
CALL FC 21 // ***** SLAVE 2 *****
DBPA :=50 // Number of DB "parameter sets" (DBPA)
SYPA :=0 // Beginning of system parameters in DBPA
SLPA :=20 // Beginning of slave parameters in DBPA

Network 4 : Call receive DP


CALL FC 22 // ***** SLAVE 1 *****
DBPA :=50 // Number of DB "parameter sets" (DBPA)

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 27
User Manual

SYPA :=0 // Beginning of system parameters in DBPA


SLPA :=8 // Beginning of slave parameters in DBPA
CALL FC 22 // ***** SLAVE 2 *****
DBPA :=50 // Number of DB "parameter sets" (DBPA)
SYPA :=0 // Beginning of system parameters in DBPA
SLPA :=20 // Beginning of slave parameters in DBPA
BE

FC99: DP diagnostics
Network 1 : Diagnostics request?
AN M 10.0 // Diagnostics request
BEC

Network 2 : Diagnostic data slave1


L 1023 // Diagnostic address from hardware configuration
T #diag_adresse
A M 10.1 // Reading in process
JC END // ==> End
CALL SFC 13 // Store diagnostic data slave 1 in bytes 0 to 5
REQ :=M10.0
LADDR :=#diag_adresse
RET_VAL :=#ret_value
RECORD :=P#DB99.DBX 0.0 BYTE 6
BUSY :=M10.1
END: NOP 0

Network 3 : Diagnostic data slave2


L 1022 // Diagnostic address from hardware configuration
T #diag_adresse
A M 10.2 // or reading in process
BEC // ==> Terminate
CALL SFC 13 // Store diagnostic data slave 2 in bytes 6 to 11
REQ :=M10.0
LADDR :=#diag_adresse
RET_VAL :=#ret_value
RECORD :=P#DB99.DBX 6.0 BYTE 6
BUSY :=M10.2
BE

FC100: TEST_PKW
Example program for 2 DP slaves
Network 1 : Initiate PKW requests for slave 1
OPN DB 100 // DB "net data"
AN M 100.0
JC W1
R M 100.0
L W#16#71CE // Write P 462
T DBW 20
L W#16#100 // Index = 1
T DBW 22
L 50 // Value = 50
T DBW 26
S DBX 3.0
BEU
W1: AN M 100.1
JC W2
R M 100.1
L W#16#61CE // Read P 462
T DBW 20
L W#16#100 // Index = 1

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


28 E20125-C0010-S302-A1-7600
User Manual

T DBW 22
S DBX 3.0
BEU
W2: AN M 100.2
JC W3
R M 100.2
L W#16#71D5 // Write P 469
T DBW 20
L W#16#100 // Index = 1
T DBW 22
L 50 // Value = 50
T DBW 26
S DBX 3.0
BEU
W3: NOP 0

Network 2 : Initiate PKW requests for slave 2


AN M 101.0
JC W4
R M 101.0
L W#16#71CE // Write P 462
T DBW 62
L W#16#100 // Index = 1
T DBW 64
L 50 // Value = 50
T DBW 68
S DBX 45.0
BEU
W4: AN M 101.1
JC W5
R M 101.1
L W#16#61CE // Read P 462
T DBW 62
L W#16#100 // Index = 1
T DBW 64
S DBX 45.0
BEU
W5 AN M 101.2
JC W6
R M 101.2
L W#16#71D5 // Write P 469
T DBW 62
L W#16#100 // Index = 1
T DBW 64
L 50 // Value = 50
T DBW 68
S DBX 45.0
W6: BE

6.5 Parameterization of the drives

Parameterization of the PROFIBUS-DP interface for MASTERDRIVES VC(CU2) with CB1 or CBP.
Requirements: Access level P051=3, function selection "hardware configuration" P052=4. (The example
parameterization can only be used if no technology module is plugged into the drive!):

Designation Parameters
Parameterization enable P053 = 3 (parameterization enable CB1/CBP and PMU)
Module in slot 2 P090 = 1 (CB1/CBP in slot 2)
Bus address P918 = 3 or 4
Frame failure time P695 = 10ms
Control bit connection P554, i001 = 3001 (control word, bit 0 = on/off1 = PZD1, bit 0)
etc.
Setpoints P443, i001 = 3002 (main setpoint = PZD2)
etc.

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 29
User Manual

Actual values P694, i001 = 968 (status word = PZD1)


P694, i002 = 218 (main actual value = PZD2)

With this parameterization the status word of MASTERDRIVES is received from the DP master. The drive can
be operated with the control word (settings such as 9C7EHEX = OFF, 9C7FHEX = ON). The 2nd word in the
transmit frame of the DP master is interpreted as a main setpoint by the drive. The drive returns the main actual
value at this point.

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


30 E20125-C0010-S302-A1-7600
User Manual

7 Abbreviations

ANZ Error byte in the pre-assignment block

CB1 Communication board 1


CBP Communication board PROFIBUS
CU Basic module of MASTERDRIVES

DB Data block
DBB Data byte
DBND Net data block
DBPA Data block for system and slave communication parameter sets
DBW Data word
DP Distributed I/Os
DVA Variable-speed drives

FC Frequency control (closed-loop control implementation of MASTERDRIVES)


FC S7 function (block in the SIMATIC S7)
FW Flag word

HIW Main actual value


HSW Main setpoint

IND Index in PPO


IW Input word

KANZ Communication status word


KSTW Communication control word

MB Flag byte

OB Organization block

PAFE Parameterization error


PANF Initial address of slave I/O area
PKE Parameter ID in PPO
PKW Parameter ID value
PPKW Initial address of DP I/O area for PKW data
PPO Parameter process data object
PPZD Initial address of DP I/O area for process data
PWE Parameter value in PPO
PZD Process data

QVZ Acknowledgment delay


QW Output word

SIMATIC S7 PROFIBUS-DP Functions  Siemens AG 1997 All Rights Reserved


E20125-C0010-S302-A1-7600 31
User Manual

RFG Ramp-function generator

SANZ Number of slaves with the same PPO type


SC Servo control (closed-loop control implementation of MASTERDRIVES)
SFC System function in STEP 7
SLPA Slave related parameters
STL Statement list
STW Control word in PPO
SYPA System parameters

TNU1 Initial node number

USS Universal serial interface

VC Vector control (closed-loop control implementation of MASTERDRIVES)

WDH Number of permissible repetitions of a PKW request

ZSW Status word in PPO

 Siemens AG 1997 All Rights Reserved SIMATIC S7 PROFIBUS-DP Functions


32 E20125-C0010-S302-A1-7600
Automation & Drives Group
Variable-Speed Drives Division
PO Box 3269, 91050 Erlangen
Federal Republic of Germany

Siemens Aktiengesellschaft Subject to change without prior notice Order No. E20125-C0010-S302-A1-7600
Printed in the Fed. Rep. of Germany

Você também pode gostar