Detailed Explanation of TCP/IP Communication Based on Ethernet

Detailed Explanation of TCP/IP Communication Based on Ethernet

Basic Concepts of Ethernet

Before performing Ethernet communication, it is necessary to understand several basic concepts of Ethernet communication, such as IP address allocation, PC network address and settings, etc.

Allocating IP Address

If the programming device (such as PC) connects to the factory LAN (or the Internet) using a network card, then the programming device and PLC must be in the same subnet.IP address combined with the subnet mask can specify the device’s subnet.

The network ID is the first part of the IP address, which is the first three octets (for example, if the IP address is 211.154.184.16, then 211.154.184 represents the network ID), which determines the user’s IP network. The subnet mask value is usually 255.255.255.0; however, since your computer is in the factory LAN, the subnet mask may have a different value (for example, 255.255.254.0) to set a unique subnet. The subnet mask defines the boundaries of the IP subnet through logical AND operations with the device’s IP address.

Setting PC Network Address Information

If you are using a WIN7 operating system, you can follow these steps to allocate or check the programming device’s IP address:

1, open “Control Panel”“Network and Sharing Center”:

Detailed Explanation of TCP/IP Communication Based on Ethernet

2, click “Local Area Connection”, view properties:

Detailed Explanation of TCP/IP Communication Based on Ethernet

3、Set the IP address of the PC to be in the same subnet as the PLC.

Assuming the IP address of the PLC is 192.168.2.1, then the IP address of the PC should be set to an address with the same network ID (for example: 192.168.2.200), with the subnet mask set to 255.255.255.0. The default gateway can be left blank. This will allow the PC to connect to the CPU. As shown in the figure below:

Detailed Explanation of TCP/IP Communication Based on Ethernet

PING Command

Using the PING command, you can check whether the local TCP/IP protocol is functioning properly, and whether it can connect to other computers in the LAN.

If your computer is running the Win7 operating system, you can follow these steps:

1, click “Start”“Run”, and in the input box, type “cmd”:

Detailed Explanation of TCP/IP Communication Based on Ethernet

2, click OK, and the command window will pop up:

Detailed Explanation of TCP/IP Communication Based on Ethernet

3, input ping 127.0.0.1” command to check whether the local TCP/IP protocol is normal; if the sent and received data are the same, it is normal, as shown in the figure below:

Detailed Explanation of TCP/IP Communication Based on Ethernet

4, input ping network device ip” command to check whether the local machine can connect to other computers in the LAN:

(1)① input ping 192.168.40.146” command, press enter, and ② will show the ping result, 0% loss” indicates a normal connection to the computer with IP address 192.168.40.146.

Detailed Explanation of TCP/IP Communication Based on Ethernet

(2)① input ping 192.168.40.127” command, press enter, and ② will show the ping result, 100% loss” indicates cannot connect to the computer with IP address 192.168.40.127.

Detailed Explanation of TCP/IP Communication Based on Ethernet

Note: In the statistics, only showing data packets 0% loss” indicates that the communication connection is normal.

Detailed Explanation of TCP/IP Communication Based on Ethernet

END

Leave a Comment