CP342-5 DP Master Slave en
CP342-5 DP Master Slave en
CP342-5 DP Master Slave en
https://support.industry.siemens.com/cs/ww/en/view/109744374
This entry is from the Siemens Industry Online Support. The general terms of use
(http://www.siemens.com/terms_of_use) apply.
Security Siemens provides products and solutions with industrial security functions that
Informa- support the secure operation of plants, systems, machines and networks.
tion In order to protect plants, systems, machines and networks against cyber
threats, it is necessary to implement – and continuously maintain – a holistic,
state-of-the-art industrial security concept. Siemens’ products and solutions only
form one element of such a concept.
Customer is responsible to prevent unauthorized access to its plants, systems,
machines and networks. Systems, machines and components should only be
connected to the enterprise network or the internet if and to the extent necessary
and with appropriate security measures (e.g. use of firewalls and network
segmentation) in place.
Additionally, Siemens’ guidance on appropriate security measures should be
taken into account. For more information about industrial security, please visit
http://www.siemens.com/industrialsecurity.
Siemens’ products and solutions undergo continuous development to make them
more secure. Siemens strongly recommends to apply product updates as soon
as available and to always use the latest product versions. Use of product
versions that are no longer supported, and failure to apply latest updates may
increase customer’s exposure to cyber threats.
To stay informed about product updates, subscribe to the Siemens Industrial
Siemens AG 2017 All rights reserved
Contents
1 Introduction ........................................................................................................ 3
2 CP 342-5 as DP Master ...................................................................................... 4
2.1 Setup .................................................................................................... 4
2.2 Address Area of the Inputs and Outputs .............................................. 4
2.3 Module Start Address ........................................................................... 5
2.4 Parameterization of the DP_SEND and DP_RECV Instructions ......... 6
3 CP 342-5 a DP Slave .......................................................................................... 8
3.1 Setup .................................................................................................... 8
3.2 Set DP Slave Mode .............................................................................. 9
3.3 Create Transfer Areas .......................................................................... 9
3.4 Module Start Address ......................................................................... 10
3.5 Parameterization of the DP_SEND and DP_RECV Instructions ....... 10
1 Introduction
If you are operating an S7-300 PROFIBUS CP as DP master or DP slave, then you
have to call the DP_SEND and DP_RECV instructions in the user program of the
CPU.
STEP 7 (TIA Portal) includes the DP_SEND and DP_RECV instructions in the
"Instructions" task card under "Communication > Communications Processor >
SIMATIC NET CP > PROFIBUS CP".
Siemens AG 2017 All rights reserved
2 CP 342-5 as DP Master
This chapter describes how to configure and program an S7-300 PROFIBUS CP
as DP master in STEP 7 (TIA Portal). In the example, a CP 342-5 is used as DP
master.
The DP_SEND instruction transfers the data of a specified DP output area to the
PROFIBUS CP for output to the distributed IO.
The DP_RECV instruction reads the process data of the distributed IO and status
information into the specified DP input area.
Figure 2-1
DP_RECV
inputs
CPU CP DP slave
(DP master)
outputs
DP_SEND
2.1 Setup
Siemens AG 2017 All rights reserved
2. Slave_2
– 1 byte DI with the address area 380-381
– 1 byte DO with the address area 470-471
3. Slave_3
– 1 byte DI with the address area 2000-2001
– 1 byte DO with the address area 2140-2141
1. Mark the CP 342-5 in the Network view or Device view. The properties of the
CP 342-5 are displayed in the inspector window.
2. Go to the "General" tab and navigate to "I/O addresses" to determine the
module start address. In this example the CP 342-5 has the following module
start address: 256 (dec) = 16#100 (hex).
DP_SEND
The following figure shows the call of the DP_SEND instruction.
Figure 2-3
DP_RECV
The following figure shows the call of the DP_RECV instruction.
Figure 2-4
Note If you use the start address 0 for address area of the inputs,
p#DB*.DBX0.0 Byte *, for example, then in program processing you can access
the areas of the data blocks using the download and transfer commands as if the
address of the data block corresponds to the addresses of the process IO.
You use the command "L DB2.DBB380" to read the input EB 380.
You use the command "T DB1.DBB470" to write to the output AB 470.
The outputs are transferred and the inputs are loaded.
3 CP 342-5 a DP Slave
This chapter describes how to configure and program an S7-300 PROFIBUS CP
as DP slave in STEP 7 (TIA Portal). In the example, a CP 342-5 is used as DP
slave.
If you use the CP 342-5 as DP slave, you call the DP_SEND and DP_RECV
instructions in the user program of the S7-300 CPU. In this way the data is
transferred from the S7-300 CPU to the CP 342-5 and read.
The DP_SEND instruction transfers the input data of the DP slave to the
PROFIBUS CP for transfer to the DP master.
The DP_RECV instruction reads the output data transferred from the DP master
into the DP data area specified in the instruction.
The DP master reads the data out of the CP 342-5 and writes the data to the
CP 342-5. In this way the CP 342-5 functions as a data buffer between the
controllers of the DP slave and the DP master. You have to configure a
communication for the DP slave and the DP master.
Figure 3-1
DP_SEND
inputs
CPU CP DP master
(DP slave)
Siemens AG 2017 All rights reserved
outputs
DP_RECV
3.1 Setup
In section 3.5 we describe the parameterization of the DP_SEND and DP_RECV
instructions taking the example below (see Figure 3-2).
Figure 3-2
You have to create the transfer areas for the data exchange with the DP master.
1. Mark the CP 342-5 in the Network view or Device view. The properties of the
CP 342-5 are displayed in the inspector window.
2. Go to the "General" tab and under "Operating mode > I-slave communication"
you create the transfer areas for data exchange with the DP master. The
transfer area for the inputs has a length of 15 bytes. The transfer area for the
outputs has a length of 35 bytes.
3. Only specify the master address. The slave address is configured with the
DP_SEND and DP_RECV instructions.
Instructions
Call the DP_SEND and DP_RECV instructions in the user program of the CPU. In
this example the call is made cyclically in OB1.
DP_SEND
With the DP_SEND instruction the input addresses are sent to the DP master.
The following figure shows the call of the DP_SEND instruction.
Figure 3-3
DP_RECV
With the DP_RECV instruction the output addresses of the DP master are
received.
Siemens AG 2017 All rights reserved
Data transfer with DP_RECV has been successfully completed when all the
following conditions are fulfilled:
Value of the output ERROR = false
Value of the output NDR = true
Value of the output STATUS = 16#0000
When the data has been transferred successfully, the value of the output STATUS
changes between 16#0000 und 16#8180 and the value of the output NDR changes
between true and false, because the DP_RECV instruction is called cyclically.
Siemens AG 2017 All rights reserved