Help with Profibus CPU315-2 DP

Rafael Guedes

Member
Join Date
Sep 2007
Location
Rio das Ostras
Posts
2
I'm a newbie on profibus, and I have to send and receive some bits that are on two DBs.
I know how to do this via CP cards using the FC1 and FC2 (DP_SEND and DP_RECV), but this time I have to use the built in DP connection on the CPU, and I could not find any good material to help me on doing this.
What I have to do is to send some physical digital inputs here to a third party PLC, and this last will give me back the signal for my outputs, that's simple stuff, but I can't figure out how to do this...
Thanks
 
Hello and welcome to the forum Rafael.

Either the 315-2DP has to be master and the 3rd party device has to be master, or vice-versa. If the 3rd party PLC is not a Siemens, then you have to import the 3rd party PLCs GSD file into the HW Configuration in STEP7.
Then you use the SFC14/15 DPRD_DAT/DPWR_DAT in much the same way you would use DP_RECV/DP_SEND.
 
Thanks for the response,
The only problem I see is usind DP_SEND/DP_RECV, I send a DB containing my Inputs and Outputs Map. With the SFC14 and SFC15 I can only send bytes, am I right? How do I configure these bytes adresses, so I can tell the Third party what the have to look for on the network?
 
communicate two PLC CPU

Hi, see this tread from Siemens Site, hope u will find useful,
(Khairul Basar)
**How is an open TCP communication connection established between two S7-300 PN CPUs, and how is data exchanged?
Instructions:
The attached sample program shows how two ST-300 stations with the CPU315-2 PN/DP are connected via the integrated PROFINET interface and how data can be exchanged with the aid of open TCP/IP communication.

( 36 KB )
Fig. 01: Communication between two CPU315-2 PN/DPs via Ethernet

The connection on the PN CPU is not configured in NetPro. The requisite parameters are saved in a user-defined structure (UDT) in a data block. The connection is established in runtime by calling the FB65 ("TCON") function block. Once the connection with the partner station is established, data can be exchanged by means of the FB63 ("TSEND") and FB64 ("TRCV") function blocks. The FB66 ("TDISCON") function block disables the connection again.

Features of communication and of the function blocks for open communication:
  • Communication is connection-oriented, i.e. data transfer does not occur until (and only for as long as) a connection is established with the partner station
  • All the requisite connection settings (e.g. IP address) must be saved in a data block whose structure is specified by the UDT65
  • If a connection has been established, it is monitored by the CPU and, if it is interrupted, reconnection occurs automatically
  • All four function blocks work asynchronously and can last several OB1 cycles
  • TSEND and TRCV can communicate simultaneously via one connection
  • Data blocks up to a size of 1460 bytes can be sent and received
  • The blocks are contained under "Standard Library -> Communication Blocks"
Description of the sample program:
The sample program comprises two separate projects. The projects are separated in terms of the way the connection is established (active/passive). In the description below, the station which establishes the connection actively is called the active station and the station which establishes the connection passively is called the passive station. This designation has nothing to do with transmitting and receiving. Both the active and the passive stations can transmit and receive (including on the same connection).

The connection settings are saved in the DB5 ("CON settings") data block and have been created using the Open Communication Wizard. You can find this wizard and a guide to it in Entry ID 25209116.

The following figure illustrates which parameters are, or have to be, known in the active and passive stations, apart from the unique IP address.
Active stationPassive stationOwn IP address140.140.140.62140.140.140.64

Subnet mask255.255.0.0255.255.0.0Remote IP address140.140.140.64140.140.140.62Local TSAP/port(2000)2001Remote TSAP/port2001(2000)

In this example, the functionality of the T-blocks is encapsulated in an FB with a simple user interface. Here, the FB100 ("my_SEND") is called in the active station, and the FB101 ("my_RECV") is called in the passive station.

How the FB100 ("my_SEND") operates:
The FB100 is called in the OB1 cycle. The calls for the FB65 ("TCON"), FB63 ("TSEND") and FB66 ("TDISCON") can be found in this FB.

PN_TCP_2_PN_CPU_02.gif

Fig. 02
REQ:Communication job starts on receipt of a positive edgeDONE:Signals that a job has been successfully completedHOLD_CON:If this marker is set, disconnection does not occurBUSY:Signals that a job is being processedID:Connection ID (must match the ID in the connection data block)ERROR:Signals that an error has occurred during the processing of an order (precise error codes in the instance data block)LEN:Length of data being sent in bytesSTATUS:Internal status of the FB100CON settings:ANY pointer to the connection data block

A communication job is initiated when the REQ input receives a positive edge, and the data with length LEN is transmitted from the DB6 ("SEND_DATA"). Since communication runs asynchronously, the block is locked internally, i.e. a new job cannot be started until there is no other job running. Via the HOLD_CON input parameter you can indicate whether to maintain the connection with the partner or to disconnect after each transmission.

The ID input parameter must match the connection ID in the "CON settings" data block. The LEN input parameter characterizes the length of data being sent in bytes. At the "CON settings" parameter, a reference is made to the connection parameters in the form of a UDT65 as an ANY pointer (in this example, a reference to DB5 "CON settings").

The output parameters DONE, BUSY, ERROR and STATUS are required for the job evaluation and are only valid in the same cycle. N.B. The output parameters only describe the status of the FB100. You can find further status parameters (TCON, TSEND, TDISCON) in the instance data block for the FB100.

Note:
Since data can only be transmitted while there is a connection in place, the partner may receive incomplete data, and thus an invalid frame, if disconnection occurs immediately after transmission. Therefore, we would advise you to set the HOLD_CON parameter to "true", in general, when calling the FB100.

disk_35.gif
Pn_cpu_a.zip ( 341 KB )

The STEP 7 project contains an executable sample program for calling the FB100, as well as the FB100 with all the sub-blocks. It has been created with STEP 7 V5.4.

How the FB101 ("my_RECV") operates:
The FB101 is called in the OB1 cycle. The calls for the FB65 ("TCON"), FB64 ("TRCV") and FB66 ("TDISCON") can be found in this FB.

PN_TCP_2_PN_CPU_03.gif

Fig. 03 EN_R:Data can be received if "true" is setNDR:Signals that a new data record has been receivedHOLD_CON:If this marker is set, disconnection does not occurERROR:Signals that an error has occurred during the processing of an order (precise error codes in the instance data block)ID:Connection ID (must match the ID in the connection data block)STATUS:Internal status of the FB100LEN:Length of data due to be received in bytesRCVD_LEN:Length of data received in bytesCON settings:ANY pointer to the connection data block

If an input EN_R is set (true), the communication blocks are called and data is received. The received data is saved in DB7 ("RECV_DATA"). If EN_R is not set (false), communication is interrupted. Re-initialization occurs the next time a positive edge is received. Via the HOLD_CON input parameter you can indicate whether to maintain the connection with the partner or to disconnect after receiving each communication.

The ID input parameter must match the connection ID in the "CON settings" data block. The LEN input parameter characterizes the length of data being received in bytes. At the "CON settings" parameter, a reference is made to the connection parameters in the form of a UDT65 as an ANY pointer (in this example, a reference to DB5 "CON settings").

The output parameters DONE, ERROR and STATUS are required for the job evaluation and are only valid in the same cycle. N.B. The output parameters only describe the status of the FB101. You can find further status parameters (TCON, TRECV, TDISCON) in the instance data block for the FB101.

disk_35.gif
Pn_cpu_p.zip ( 335 KB )

The STEP 7 project contains an executable sample program for calling the FB101, as well as the FB101 with all the sub-blocks. It has been created with STEP 7 V5.4.

Commissioning the active and passive stations:
No.Procedure1Load the file "Pn_cpu_a.zip" or "Pn_cpu_p.zip" onto your PC.

2Extract the archive with STEP 7.

3If you wish to change the PC's IP address or subnet mask, you have to do this in the HWCONFIG as well as in the connection specification. In the event of a change in the connection specification, you are advised to generate a new UDT (using the Open Communication Wizard, Entry ID 25209116). You can then also recreate the connection data block (in this case, DB5 "CON settings").

4Load the project into the station.5Start to establish the connection by activating the FB100 and FB101 blocks via the M120.0 ("Control" variables table).
 
@Rafael.
It works the same way. Both with DP_SEND/DP_RECV and DRWR_DAT/DPRD_DAT the data is specified as an ANY pointer.
If you have the data defined symbolically in a DB, you can pass it as a symbol. If you switch symbolic display off, you can see that the ANY pointer is really a combination of start address and how many bytes to transfer.

@Apel.
You seem to have missed that there is only the DP port available, no PN port.
 

Similar Topics

Hello everyone , im using a IM153 as Decentral Peripherie, it uses profibus and it is a slave with the adress N° 2 everytime there is a problem...
Replies
5
Views
566
After replacing the 70 with the 525, the PLC can read from the drive and recognizes it as online, but no commands are being listened to. PLC is...
Replies
1
Views
492
Ok, We have a couple of hundred PF753's with 20-COMM-P cards installed. I recently had one fail, and it would not communicate over the...
Replies
7
Views
2,102
Dose anyone have experience with Beckhoff FC3121 profibus master PCIe card connected to Siemens CP342-5 as a profibus slave? The data retrieved...
Replies
17
Views
4,738
Hello dear members. I've been looking for a GSD file of a Litronic pulsregler with no success. I Cant even find a contact of the manufacturer. By...
Replies
3
Views
1,283
Back
Top Bottom