Steps for configuring the PROFINET X2 interface in the S7-1200 project

Publisher:jingwenLatest update time:2024-05-30 Source: elecfansKeywords:S7-1200 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

In the safety system, F-CPUs can use the PN/PN Coupler module to perform safety-related communication between controllers. Communication is performed through two safety application blocks, namely the SENDDP block for sending data and the RCVDP block for receiving data. These blocks are called by the user in the corresponding safety program of the F-CPU to send 16 data of the BOOL data type and 2 data of the INT data type or 1 data of the DINT data type (S7-1200, S7-1500) to another F-CPU in a fail-safe manner.


In this example, CPU1513F-1PN is used as an IO controller, CPU1215FC is used as another IO controller, and safety-related communication between the two CPUs is realized through PN/PN Coupler (V4.2). CPU1513F uses F application block SENDDP to send in the safety program, and CPU1215FC uses RCVDP to receive in the safety program, transmitting 16 BOOL data and 2 INT data at a time in a safe manner. Note: RCVDP must be called at the beginning of the safety program, and SENDDP must be called at the end of the safety program.

e77f0136-4568-11ee-a2ef-92fbcf53809c.jpg

Software and hardware environment used in the example

hardware:

CPU1513F-1PN 6ES7 513-1FL02-0AB0, V2.8.3

CPU1215FC DC/DC/DC 6ES7 215-1AF40-0CB0, V4.4.1

PN/PN Coupler 6ES7 158-3AD10-0XA0, V4.2.0

software:

STEP7 Professional V16 Update2

STEP7 Safety V16

1. The first case (operation in the same project)

In this case, two CPUs are operated in one project using STEP7 V16. The detailed steps are as follows.

1.1 Create a project with STEP7 V16 and add S7-1500 and S7-1200 stations

Use STEP7 V16 to create a new project, and configure the S7-1500 and S7-1200 stations respectively through "Add New Device", select the corresponding CPU model, create their own PN/IE subnets, set their own IP addresses, and confirm the device names.
In this example, the CPU151F device name is PLC_1, and the CPU1215FC device name is PLC_2. See Figure 1.

e79e1350-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 1 Create two PLC stations in a new project

1.2 Configuring PN/PN Coupler

Find PN/PN Coupler in the "Hardware Catalog", confirm the order number, select the version, and drag it into the "Network View", as shown in Figure 2.

e7b700e0-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 2 Drag PN Coupler V4.2 into the project

e7e6ba6a-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 3 Connecting the PN Coupler PROFINET interface X1 to the PROFINET interface of the CPU1513F

e807aa72-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 4 Configuring the IP address and device name of the PN Coupler PROFINET interface X1

e82cc8fc-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 5 Configuring the IP address and device name of the X2 part of the PN Coupler PROFINET interface

Note: For secure communication, a fixed-format transmission area type must be used. Here, CPU1513F sends data to CPU1215FC, so the type with an output length of 12 bytes must be selected.

e84df7e8-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 6 Configuring PN Coupler address mapping

The two CPUs are in the same project. The system automatically generates a matching transmission area "PROFISAFE input/output 12 bytes/6 bytes" on the PLC_2 side of the PN Coupler PROFINET interface X2, as shown in Figure 7.

Note: It is best to use the IO address automatically assigned by the system. If you want to modify it, make sure that the starting address of the input address and output address assigned in the transmission area are the same.

e8678a78-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 7 PN Coupler address mapping information

e8816420-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 8 Address allocation of the transfer area in two CPUs

1.3 Assigning PN/PN Coupler device names

Click the X1 network interface on the left side of the PN Coupler with the left mouse button, hold down the mouse and drag to connect to the PROFINET interface of the CPU1513F, so that the PROFINET interface X1 of the PN Coupler is connected to the PN/IE_1 subnet, and the IO controller is assigned to PLC_1, as shown in Figure 3. Then set the IP address and device name of the X1 interface, as shown in Figure 4.

Use the same method to drag the PROFINET interface X2 of the PN Coupler to the PROFINET interface of the CPU1215FC. The network will show that it is connected to the PN/IE_2 subnet, and the IO controller will be automatically assigned to PLC_2. The words "Multiple Assignment" will be displayed in the lower left corner of the PN Coupler, and then set the IP address and device name of the X2 interface. See Figure 5.

In the PN Coupler properties interface, create "Transfer Area_1" in "Conversion Mapping" and select "PROFISAFE Input/Output 6 Bytes/12 Bytes" as the type, as shown in Figure 6.

After compiling and downloading both safety CPUs, you still need to assign the PN Coupler device name online so that PROFINET communication can be normal. In addition, since the PN Coupler has two PROFINET network ports, you need to operate them separately.

In the previous configuration, CPU1513F is connected to the PROFINET interface X1 network on the PN Coupler, so when actually connecting the network cable, the PROFINET network cable of CPU1513F should be inserted into the network port of the bus adapter on the left side of the PN Coupler. Similarly, the network cable of CPU1215FC should be inserted into the network port of the bus adapter on the right side of the PN Coupler.

e8a2ce80-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 9 PN Coupler module panel diagram

Take the CPU1513F side operation as an example to introduce the operation of assigning device names. First, ensure that the computer's network cable is connected to the PROFINET interface X1 network on the PN Coupler. Right-click the left side of the PN Coupler with the mouse, and select Assign Device Name in the pop-up dialog box, as shown in Figure 10.

e8c621e6-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 10 Right click on the left side to open the device name assignment interface

After entering the device name assignment interface, click "Update List" to display the accessible nodes in the network. Check that the MAC address is the same as the MAC ADDRESS 1 printed on the PN Coupler to ensure that it is the PROFINET X1 interface on the PN Coupler. Click "Assign Name", as shown in Figure 11.

e8ee9748-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 11 Assigning a device name

After the operation is successful, "OK" will be displayed in the status bar, as shown in Figure 12.

e9110cec-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 12: Assigning device name completed

Use the same steps to assign a device name to the PROFINET interface X2 of the PN Coupler. After completion, the network view shows that the communication is normal after it is online, as shown in Figure 13.
Note: At this time, the computer's network cable must be connected to the PROFINET interface X2 network on the PN Coupler, and right-click the right side of the PN Coupler with the mouse to check that the MAC address is the same as the MAC ADDRESS 2 printed on the PN Coupler.

e923c684-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 13 Hardware configuration online status

1.4 Programming and downloading

In addition to hardware configuration, safety-related communications also require the use of dedicated safety communication program blocks to send and receive data.

Add an F-DB in the CPU1513F program block, name it "SendData" and create 16 BOOL type and 2 INT type variables for sending data. Add an F-DB in the CPU1215FC program block, name it "RcvData" and create 16 BOOL type and 2 INT type variables for receiving data, as shown in Figure 14.

e938331c-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 14: The structure of the sending data block in CPU1513F

e9641cac-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 15 Receive data block structure in CPU1215FC

In the example, CPU1513F sends data to CPU1215FC, so the SENDDP data sending function block is called in the safety main program FB1 of CPU1513F. Pay attention to the filling of parameters DP_DP_ID and LADDR. The location of the instruction is shown in Figure 16.

e97dd9d0-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 16 Instruction location

e9abca34-4568-11ee-a2ef-92fbcf53809c.jpg

The LADDR parameter needs to be found in the properties of the PN Coupler X1 interface section as the system constant of "Transmission Area_1", as shown in Figure 17.

e9cb7fbe-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 17 Finding the system constants of the transmission area_1 configured in the PN Coupler X1 interface

The RCVDP data receiving function block is called in the safety main program FB1 of CPU1215FC, and the parameter DP_DP_ID must be consistent with the SENDDP of CPU1513F, as shown in Figure 16.

e9e24118-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 18 The DP_DP_ID of the receiving function block in CPU1215FC must be consistent with the sending function block in CPU1513F

ea000b8a-4568-11ee-a2ef-92fbcf53809c.jpg

The LADDR parameter needs to be found in the properties of the PN Coupler X2 interface section as the system constant of "Transmission Area_1", as shown in Figure 19.

ea2584c8-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 19 Finding the system constants of the transmission area_1 configured in the PN Coupler X2 interface

In the example, CPU1513F sends 2 INT type data to CPU1215FC. If you want to send DINT type data, you only need to fill in the data address to be sent in the input parameter SD_DI_00 of the SENDDP function instruction, and set the input parameter DINTMODE=1.

At this time, CPU1215FC can receive DINT data at the output parameter RD_DI_00 of the RCVDP function instruction. Note: INT and DINT data cannot be transmitted at the same time.

Compile the programs of the two PLCs and then download them to the PLCs respectively.

1.5 Communication Test

After checking for errors, create new monitoring tables for the two sites and monitor the data, as shown in Figure 20.

ea3d8852-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 20 Communication test

1.6 What to do when a communication error occurs

If a communication error occurs, the sender (SENDDP instruction) sets the output parameters ERROR and SUBS_ON = 1 and displays information about the type of communication error that occurred at the output parameter DIAG.

The receiver (RCVDP instruction) replaces the fail-safe values ​​specified by the input parameters SUBBO_xx and SUBI_xx or SUBDI_00 at the corresponding outputs and sets the outputs ERROR and SUBS_ON = 1. Information about the type of communication error that occurred is displayed at the output parameter DIAG.

ea6b0994-4568-11ee-a2ef-92fbcf53809c.jpg

Figure 21 SENDDP/RCVDP instruction DIAG structure description

When the communication error is no longer detected, the RCVDP instruction sets the output parameter ACK_REQ = 1, and safe data transfer is resumed with an acknowledgement of the rising edge at the input parameter ACK_REI.

[1] [2]
Keywords:S7-1200 Reference address:Steps for configuring the PROFINET X2 interface in the S7-1200 project

Previous article:Design of Motor Control System Based on FPGA
Next article:What should I do if the PLC output point is broken?

Latest Embedded Articles
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号