Please Contact Us if Necessary , Email :
【Technical Class】S7 200 SMART Open Ethernet Communication—TCP Free Port

【Technical Class】S7 200 SMART Open Ethernet Communication—TCP Free Port

1. Brief introduction

Compared with the previous 200, the Smart200 has many advantages. The most prominent one is the addition of an Ethernet port. Say goodbye to the troubles of the PPI cable. You only need a network cable to upload and download programs. You can also connect to the PLC through wifi. Do you think Is its network port limited to this? No, let's take a look at his TCP free port communication today.

The PUT/GET of Smart200 is believed to be used by everyone. It is very convenient, but it only supports the S7 protocol and cannot communicate with other devices via Ethernet. Therefore, smart has opened up Ethernet communication to make the communication between smart and third-party devices more efficient. Convenience and efficiency.

TCP free port communication belongs to bilateral communication, that is, both sides of the communication must write programs, and one is the active party. to actively send data, and one acts as the passive party. To passively receive data, here smart provides us with the library that PLC needs to use, which makes PLC programming much easier and faster.

2. Sample program

Today we use 2 smarts to understand the TCP free port, we need to use the above three commands: TCP_CONNECT, TCP_SEND and TCP_RECV.

First write the active program, first establish the connection, write the send and receive blocks:

Write a passive program, then create a connection in another PLC, write send and receive blocks:

The above is the program that needs to be written in the PLC for active sending and passive receiving. Remember to allocate the library storage area, and the addresses should not overlap. Active or passive connections can be added to form a complex network on either the active side or the passive side.


3. Examples of communication

1. Communication between PLC and PLC

Download the active program written above to the PLC of, and the passive program to the program of to see the effect of communication, as shown in Figure 1 and Figure 2 below. In order to facilitate the viewing effect, the data sent by the two PLCs are 12 bytes starting from VW500, and the data received are 12 bytes starting from VW600. As can be seen from Figure 1 and Figure 2 below, the data sent and received by both parties One-to-one correspondence.

2. View data between PLC and computer through debugging assistant

Next, let's take a look at Freeport TCP from the perspective of a debugging assistant.

In Figure 3 below, you can see that the IP of the computer is, the IP of the PLC is, and the PLC is actively connected. Our debugging assistant selects TCPServer. After filling in the correct local and remote port numbers and IPs, we monitor the packets. It can be seen that the 12 bytes sent by the PLC starting from VW500 are received by the debugging assistant, and the debugging assistant sends the hexadecimal 00 11 00 12 00 13 00 14 00 15 00 16 message to the PLC, and the PLC starts from VW600 The 12 bytes of hexadecimal data are also received, corresponding to the data.

In Figure 4, you can see that the IP of the computer is, the IP of the PLC is, and the PLC is connected passively. Our debugging assistant selects TCPClient. After filling in the correct local and remote port numbers and IPs, we successfully connect to the PLC. Send the hexadecimal 00 09 00 08 00 07 00 06 00 05 00 04 data to the PLC through the debugging assistant, you can see that the PLC receives the data sent by the debugging assistant from the 12 bytes starting from VW600, and the VW500 sent by the PLC The first 12 bytes are also received by the debug assistant.



Leave a comment

Please note: comments must be approved before they are published.

If You Would Like to Contact Support or Make a Purchase Please Fill out the Form

If you have urgent needs, please call our customer service number

Please fill in your information in detail so that our support staff can clearly understand your needs.

Value is required
Value is required
Please input the correct email address
Value is required
Thank you!