How we can transfer and receive data s between two s7 300 plc?

 S7 communication protocol is the essence of Siemens S7 series PLCs. It is an optimized protocol used for communication between S7 series PLCs via Ethernet. In this article, we will discuss how to utilize S7 communication to exchange data between two S7-300 PLCs.

S7 communication possesses the following characteristics:

  • Requires SIMATIC CP module or PN port integrated into the CPU.
  • Requires hardware configuration.
  • Requires support for dedicated instructions.

The instructions for S7 communication can be categorized as follows:

  • Instructions for data exchange.
  • Instructions for querying operating modes.
  • Instructions for changing operating modes.
  • Instructions for querying link status.

This article will use data exchange instructions with hardware platforms being CPU 315-2PN/DP and CPU 317-2PN/DP, connected via Ethernet cable through the PN ports of both CPUs. Single-sided communication will be employed, with hardware configuration and software programming conducted solely on the CPU 315-2PN/DP side. The IP parameters for both sites are as follows:



First, configure the hardware for CPU 315-2PN/DP and set the IP address to 192.168.0.2, as shown in the following diagram:



Open the network configuration tool (NetPro), right-click to add a new S7 connection (S7 Communication), as shown in the following image:



Double-click on the newly added S7 connection (S7 connection) to open the properties dialog box. In the "Communication Path" section, add the IP address of the communication partner, as shown in the following image:


Click on the "Address Details" button to open the dialog box. Modify the "Rack/Slot" to match the actual settings of the communication partner. For S7-300 CPU, the rack is generally 0 and the slot number is 2, as shown in the following image:



At this point, hardware and network configuration are completed. Compile the configuration and download it to the CPU 315-2PN/DP.

Next, proceed with software programming. Utilize the FB14 "GET" instruction to retrieve data from the remote PLC (CPU 317-PN/DP). The program block is as follows:

The meanings of parameters for each pin of the instruction are as follows in the table below:

Meaning of parameters  (Photo: Simens)


Utilize the FB15 "PUT" instruction to write data into the remote PLC. The program block is as shown in the following figure:




The meanings of parameters for each pin of the instruction are as follows in the table below:

Meaning of parameters  (Photo: Simens)


Compared to using open TCP or UDP protocols, programming with the S7 communication protocol is relatively simple, but it requires hardware configuration.

Well, that's all for the introduction to S7 communication between two S7-300 PLCs via the PN port.