13 Ethernet Communication

Last modified by Wecon on 2025/09/03 21:03

Overview of Ethernet


IP Address Concept


IP addresses consist of network addresses and host addresses, which are distinguished by subnet masks. If a programming device (such as a PC) needs to be connected to a factory LAN via a network card, the programming device and the PLC must be in the same subnet. The IP address is combined with a subnet mask to specify the subnet of the device.

No.Network equipment 1Network equipment 2Network connection
 IPSubnet maskNetwork addressIPSubnet maskNetwork address 
1192.168.0.1255.255.255.0192.168.0.0192.168.0.10255.255.255.0192.168.0.0Yes
2192.168.0.1255.255.255.0192.168.0.0192.168.1.10255.255.255.0192.168.1.0No
3192.168.0.1255.255.255.1192.168.0.1192.168.0.10255.255.255.1192.168.0.0No

When logical operation of IP address and subnet mask is performed, the network address can be calculated. If the addresses are in the same network, it means that communication can be carried out. For instance:

Setting PC Network Address


1.Open the control panel->Network and Internet->Network and sharing center;

1709800172136-122.png

2.Click on the local link->Attributes->Internet Protocol Version 4;

3.Set the IP address and subnet mask that are within the same network address as PLC. Note that IP addresses that have been used in LAN cannot be set. If the IP of PLC is 192.168. 8.8 and the subnet mask is 255.255. 255.0, the IP address as shown in the following figure can be set to connect the PC to PLC.

1709800197035-940.png

Testing Network Connection Status


Test the connection status of PC and PLC via ping command.

1.win+R key, input cmd;

1709800277099-298.png

2.If PLC’s IP address is 192.168.8.8;

(1)Enter ping 192.168. 8.8 command and press Enter. If 100% missing is displayed, it means that it cannot be connected with PLC.

1709800385874-944.png

(2)Enter ping 192.168. 8.8 command and press Enter. If 0% missing is displayed, it means that it can be connected with PLC.

1709800404587-687.png

(3)“ping network equipment ip”command can only be used for four times  . If it needs to further perform ping , please use the command “ping network equipmentip -t”, as shown in following figure:  

1709800414375-820.png

Ethernet connection between PLC Editor2 and PLC


1. Transmission settings->Ethernet configuration->Input the IP address of PLC; (note: the address of the network card should be in the same network segment with PLC)

1709800528216-231.png

2.Click the communication test to confirm the communication;

1709800557135-786.png

 3.After successful connection, click “select” to operate PLC.

Ethernet Search Function of PLC Editor 2


1. Transmission settings->Network card selection->Equipment search (note: the address of the network card should be in the same network segment with PLC), select “connect PLC” at 1 or the network card that is within the same network segment with PLC, and click 2 to search PLC equipment in LAN.

1709800659995-499.png

2.Search interface is shown as follows. Click search to display the PLC equipment in the LAN, select the corresponding equipment and click OK to communicate.

1709800676198-944.png

3.IP address at 1 is automatically filled in. Click the communication test to test whether the communication is normal. if it is normal, click “select” button to complete the connection configuration.

1709800686490-665.png

Ethernet Configuration


IP Address Setting


(1) Setting via programming software

Project management->parameters->PLC parameter->Ethernet configuration.

After modification, check the parameter items through PLC download; after download, click STOP->RUN to complete.

Note: Modbus TCP Server supports maximum connections, which is used to set the maximum number of external Modbus TCP clients that can be connected to PLC simultaneously, with the range being 2~8.

1709800796514-672.png

 (2) Setting via special device

Write IP address, subnet mask and default gateway in SD2680~SD2691;

When SM2680 is set as ON, open static IP function;

When SM2683 is set as ON, the sign IP can be modified;

STOP->RUN or the new IP address takes effect after power-on again.

SM signNameContentR/WSD labelName
SM2680Statically set IP switch

ON: static setting

OFF: The IP address is automatically configured by router DHCP, and the IP cannot be modified

STOP->RUN

R/WSD2680The first byte of the IP address
SM2681Display current network informationRefresh the current IP gateway subnet mask after being set as ON. OFF after refresh is completed.R/WSD2681The second byte of the ip address
SM2682Display current MAC information (reserved)Refresh the current MAC after being set as ON. OFF after refresh is completed.R/WSM2682The third byte of the ip address
SM2683IP, subnet mask, gateway modification sign

ON: can be modified

OFF: cannot be modified

(When being set as ON, STOP->RUN; it can be automatically changed to OFF after modification)

R/WSD2683The fourth byte of the ip address
SM2684   SD2684The first byte of subnet mask
SM2685   SD2685The second byte of subnet mask
SM2686   SD2686The third byte of subnet mask
SM2687   SD2687The fourth byte of subnet mask
SM2688   SD2688Default gateway first byte
SM2689   SD2689Default gateway second byte
SM2690   SD2690Default gateway third byte
SM2691   SD2691Default gateway fourth byte

TCP Protocol Concept


TCP protocol is a Transport Control Protocol, which is a connection-oriented and reliable transport layer protocol. Connection-oriented means that a normal TCP transmission needs to be completed by establishing a specific virtual circuit connection between TCP client and TCP server. To transmit data over TCP, a connection must be established between hosts at both ends. 

List of Ethernet-related Special Devices


SM signNameContentR/WPower-down save
SM2681Display current network informationRefresh the current IP, subnet mask and default gateway after being set as ON; and then being set as OFF upon completion of refreshR/W×
SM2682Display current MAC informationRefresh the current MAC after being set as ON. OFF after refresh is completed.R/W×
SM2683IP, subnet mask, gateway modification sign

ON: can be modified

OFF: cannot be modified

(When being set as ON, STOP->RUN; it can be automatically changed to OFF after modification)

R/W
SM2684Network card connection status

ON: network connected

OFF: network not connected; check if the network cable is connected

R
SM2692MAC address modification sign

ON: can be modified

OFF: cannot be modified

(When being set as ON, STOP->RUN; it can be automatically changed to OFF after modification)

R/W
SM2700Modbus TCP keep-alive mechanism

ON: Open

OFF: Close (default)

R/W
SM2701Forced shutdown of Modbus TCP server

ON: Open

OFF: Close (default) (after being enabled, it will be automatically changed into OFF after shutdown)

R/W×
SM2710Ethernet error sign

ON: there is an Ethernet error, please check SD2710 and SD2711

OFF: there is no Ethernet error

R×
SM2740ModbusTCP server connection status 1

ON: Client side has been connected

OFF: Client side hasn’t been connected

R×
SM2760ModbusTCP server connection status 2

ON: Client side has been connected

OFF: Client side hasn’t been connected

R×
SM2780ModbusTCP server connection status 3

ON: Client side has been connected

OFF: Client side hasn’t been connected

R×
SM2800ModbusTCP server connection status 4

ON: Client side has been connected

OFF: Client side hasn’t been connected

R×
SM2820ModbusTCP server connection status 5

ON: Client side has been connected

OFF: Client side hasn’t been connected

R×
SM2840ModbusTCP server connection status 6

ON: Client side has been connected

OFF: Client side hasn’t been connected

R×
SM2860ModbusTCP server connection status 7

ON: Client side has been connected

OFF: Client side hasn’t been connected

R×
SM2880ModbusTCP server connection status 8

ON: Client side has been connected

OFF: Client side hasn’t been connected

R×
SD labelNameContentR/WPower-down save
SD2680The first byte of the IP addressLocal IP addressR/W
SD2681The second byte of the ip address R/W
SM2682The third byte of the ip address R/W
SD2683The fourth byte of the ip address R/W
SD2684The first byte of subnet maskLocal subnet maskR/W
SD2685The second byte of subnet mask R/W
SD2686The third byte of subnet mask R/W
SD2687The fourth byte of subnet mask R/W
SD2688Default gateway first byteLocal default gatewayR/W
SD2689Default gateway second byte R/W
SD2690Default gateway third byte R/W
SD2691Default gateway fourth byte R/W
SD2692The first byte of MAC addressLocal MAC addressR/W
SD2693The second byte of MAC address R/W
SD2694The third byte of MAC address R/W
SD2695The fourth byte of MAC address R/W
SD2696The fifth byte of MAC address R/W
SD2697The sixth byte of MAC address R/W
SD2700Communication speed display

0: 100Mbps/half duplex

1: 100Mbps/full duplex

2: 10Mbps/half duplex

3: 10Mbps/full duplex

R×
SD2702The modbusTCP server supports the maximum number of connectionsLocal modbusTCP server supports the maximum number of clients to make connections at the same timeR/W×
SD2703Modbus TCP connectionsLocal Modbus TCP connectionsR×
SD2710Error codeEthernet error codeR×
SD2711Socket ID of the error

-1: system default Modbus TCP server

0~5: Customer custom socket error

R×
SD2720Input the low bit of the number of ping requestExternal input ping command countR×
SD2721Input the high bit of the number of ping request R×
SD2722Input the low bit of the number of ping responseNumber of replies after receiving external ping commandR×
SD2723Input the high bit of the number of ping response R×
SD2724Output the low bit of the number of ping requestSend ping command countR×
SD2725Output the high bit of the number of ping request R×
SD2726Output the low order of the number of ping responseNumber of replies after receiving sent ping commandR×
SD2727Output the high bit of the number of ping response R×
SD2728Number of arp packets sentCount of number of arp packets sentR×
SD2729Number of arp packets receivedCount of number of arp packets receivedR×
SD2730Number of ip packets sentCount of number of ip packets sentR×
SD2731Number of ip packets receivedCount of number of arp packets receivedR×
SD2732Number of tcp packets sentCount of number of tcp packets sentR×
SD2733The number of tcp packets receivedCount of number of tcp packets receivedR×
SD2734Number of udp packets sentCount of number of udp packets sentR×
SD2735Number of udp packets receivedCount of number of udp packets receivedR×

SD2740
Connection 1 local port numberConnection information and error information about the first Modbus TCP client’s connection to the PLC.R×
SD2741Connection 1 IP address first byte R×
SD2742Connection 1 IP address second byte R×
SD2743Connection 1 IP address third byte R×
SD2744Connection 1 IP address fourth byte R×
SD2745Connection 1 peer port number R×
SD2746Reserved R×
SD2747Reserved   
SD2748Connection 1 error code R×
SD2749Connection 1 error communication times low word R×
SD2750Connection 1 error communication times high word R×
SD2760Connection 2 local port numberConnection information and error information about the second Modbus TCP client’s connection to the PLC.R×
SD2761Connection 2 IP address first byte R×
SD2762Connection 2 IP address second byte R×
SD2763Connection 2 IP address third byte R×
SD2764Connection 2 IP address fourth byte R×
SD2765Connection 2 peer port number R×
SD2766Reserved R×
SD2767Reserved   
SD2768Connection 2 error code R×
SD2769Connection 2 error communication times low word R×
SD2770Connection 2 error communication times high word R×
SD2780Connection 3 local port numberConnection information and error information about the third Modbus TCP client’s connection to the PLC.R×
SD2781Connection 3 IP address first byte R×
SD2782Connection 3 IP address second byte R×
SD2783Connection 3 IP address third byte R×
SD2784Connection 3 IP address fourth byte R×
SD2785Connection 3 peer port number R×
SD2786Reserved R×
SD2787Reserved   
SD2788Connection 3 error code R×
SD2789Connection 3 error communication times low word R×
SD2780Connection 3 error communication times high word R×
SD2800Connection 4 local port numberConnection information and error information about the fourth Modbus TCP client’s connection to the PLC.R×
SD2801Connection 4 IP address first byte R×
SD2802Connection 4 IP address second byte R×
SD2803Connection 4 IP address third byte R×
SD2804Connection 4 IP address fourth byte R×
SD2805Connection 4 peer port number R×
SD2806Reserved R×
SD2807Reserved   

SD2808
Connection 4 error codeError information about the fourth Modbus TCP client’s connection to the PLC.R×
SD2809Connection 4 error communication times low word R×
SD2810Connection 4 error communication times high word R×
SD2820Connection 5 local port numberConnection information and error information about the fifth Modbus TCP client’s connection to the PLC.R×
SD2821Connection 5 IP address first byte R×
SD2822Connection 5 IP address second byte R×
SD2823Connection 5 IP address third byte R×
SD2824Connection 5 IP address fourth byte R×
SD2825Connection 5 peer port number R×
SD2826Reserved R×
SD2827Reserved   
SD2828Connection 5 error code R×
SD2829Connection 5 error communication times low word R×
SD2830Connection 5 error communication times high word R×
SD2840Connection 6 local port numberConnection information and error information about the sixth Modbus TCP client’s connection to the PLC.R×
SD2841Connection 6 IP address first byte R×
SD2842Connection 6 IP address second byte R×
SD2843Connection 6 IP address third byte R×
SD2844Connection 6 IP address fourth byte R×
SD2845Connection 6 peer port number R×
SD2846Reserved R×
SD2847Reserved   
SD2848Connection 6 error code R×
SD2849Connection 6 error communication times low word R×
SD2850Connection 6 error communication times high word R×
SD2860Connection 7 local port numberConnection information and error information about the seventh Modbus TCP client’s connection to the PLC.R×
SD2861Connection 7 IP address first byte R×
SD2862Connection 7 IP address second byte R×
SD2863Connection 7 IP address third byte R×
SD2864Connection 7 IP address fourth byte R×
SD2865Connection 7 peer port number R×
SD2866Reserved R×
SD2867Reserved   
SD2868Connection 7 error code R×
SD2869Connection 7 error communication times low word R×
SD2870Connection 7 error communication times high word R×
SD2880Connection 8 local port numberConnection information and error information about the eighth Modbus TCP client’s connection to the PLC.R×
SD2881Connection 8 IP address first byte R×
SD2882Connection 8 IP address second byte R×
SD2883Connection 8 IP address third byte R×
SD2884Connection 8 IP address fourth byte R×
SD2885Connection 8 peer port number R×

SD2866
ReservedConnection information and error information about the eighth Modbus TCP client’s connection to the PLC.  
SD2867Reserved R×
SD2888Connection 8 error code R×
SD2889Connection 8 error communication times low word R×
SD2890Connection 8 error communication times high word R×

List of Ethernet Operation Error Codes


Error codeDescriptionActionProcessing approachTest time
3680Ethernet data reception errorContinue to runCheck whether there is any interference in the environmentWhen the command is executed
3681Ethernet data reception timeoutContinue to run

Check if the network cable is loosened

1. Check whether the network peer is faulty, which results in failure in sending data.

Check whether the network peer does not respond in time, which results in any delay in data. Under such circumstance, the reception timeout in the socket configuration can be increased.

When the command is executed
3684Modbus TCP station number configuration errorContinue to run

Check slave station number setting.

Check whether there is any problem with the receiving and sending mechanism of slave station.

When the command is executed
3685Modbus TCP send buffer overflowContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
3686Modbus TCP function code errorContinue to runCheck whether the set function code is a function code supported by PLCWhen the command is executed
3687Modbus TCP address errorContinue to runCheck whether the slave station has this address. (Please refer to Modbus exception 02).When the command is executed
3688Modbus TCP length errorContinue to runCheck whether the communication length exceeds the Modbus rangeWhen the command is executed
3689Modbus TCP data errorContinue to run

Check whether parameters of the command are wrong.

Check whether the set value is supported by the slave station. (Please refer to Modbus exception 03).

When the command is executed
368AModbus TCP slave is busyContinue to runMessage returned from slave station: Slave station is busy. (Please refer to Modbus exception 06).When the command is executed
368BModbus TCP slave station does not support function codeContinue to runCheck whether this function code is supported by the slave station. (Please refer to Modbus exception 01).When the command is executed
368CModbus TCP slave failureContinue to runMessage returned from slave station: Slave station failed, please check whether slave station failed. (Please refer to Modbus exception 04).When the command is executed
368DModbus TCP slave confirmationContinue to runMessage returned from slave station: slave station confirmation. (Please refer to Modbus exception 05).When the command is executed
368E

The current protocol of Modbus TCP does not support this command

Instruction

Continue to runThe RS command cannot be used when the slave protocol is set, please change the protocol or close the contact before the RS commandWhen the command is executed
368FNetwork port send timeoutContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
3690Receive buffer overflowContinue to runCheck if the other device is sending data all the timeWhen the command is executed
36A0Unavailable gateway for Modbus TCPContinue to runMessage returned from the slave station: no available gateway. (Please refer to Modbus exception 0A).When the command is executed
36A1Modbus TCP indicates that no response was obtained from the target device. It usually means the device is not on the network.Continue to run

Message returned from the slave station: The device is not in the network.

(Please refer to Modbus exception 0B)

When the command is executed
36C0ModbusTCP transaction identifier errorContinue to runCheck if there is network congestion and data can not be received in time.When the command is executed
36C1Modbus TCP server available links are fullContinue to runCheck if SD2702 and SD2703 have too many clients to linkWhen the command is executed
36C8Insufficient space in the Ethernet stackContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
36C9Number of connections exceeds the limitContinue to runConfirm whether the total number of connections exceeds the limitWhen the command is executed
36CAThe last send is not completedContinue to runUse the sending completion sign to determine that the current sending is completed, and then send the next oneWhen the command is executed
36CBTCP write exceptionContinue to runUse the sign bit device to judge whether the current connection status is normal. If it is not normal, no data transmission will be performed. For example, after the closing sign is set, data transmission will not be performed.When the command is executed
36CCTCP output exceptionContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
36CDIP address is usedContinue to runPlease check if a connection exists with the same address informationWhen the command is executed
36CEError in server’s acceptance of connectionContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
36CFTCP receive buffer overflowContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
36D0TCP link failedContinue to runIt may be caused by opening the TCP client when the network cable is not connected.When the command is executed
36D1Exception when actively closing the connectionContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
36D2Abnormal shutdown occurred inside the protocol stackContinue to runMay be shut down due to no answering for a long time. Check whether the peer is online and can ping.When the command is executed
36D3The peer initiates an RST linkContinue to run1. Check whether the peer initiates abnormal shutdown. 2. As a client, the number of peer connections is full, or the peer port is not open.When the command is executed
36D4The protocol stack has a single-ended shutdownContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
36D5There is an IP address conflictContinue to runThe same IP device exists in the LAN, please change the IP addressWhen the command is executed
36D6There is a MAC address conflictContinue to runThe same MAC device exists in the LAN, please change the MAC addressWhen the command is executed
36D7TCP send buffer overflowContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
36D8UDP connection exceptionContinue to runIP address or port number may has been used.When the command is executed
36D9UDP send buffer overflowContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
36DAInsufficient memory space when sending UDPContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
36DBUDP send failedContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
36DCUDP memory release failedContinue to runIf this error message appears, please contact technical personnelWhen the command is executed
36DDUDP receive buffer overflowContinue to runThe length of the data received by UDP exceeds the limit value of 512.When the command is executed
4084

Data beyond the specified range is entered in the application command (for example, parameter 1 is specified as 0~1,

setting 2)

Continue to runModify application command parametersWhen the application command is executed
4085

The output result of the read application command exceeds the device range.

(For example, the maximum output of the D device is D7999, but D8000 is used)

Continue to runModify application command parametersWhen the application command is executed
4086

The output result of the write application command exceeds the device range.

(For example, the maximum output of the D device is D7999, but D8000 is used)

Continue to runModify application command parametersWhen the application command is executed
5080The Ethernet socket has been linked and cannot be opened repeatedly.Continue to runCheck if SOCOPEN command is executed repeatedlyWhen the application command is executed
5081Ethernet socket is not open, which results in the failure in operationContinue to runCheck whether set ON the connected sign bit of the SOCOPEN command (d2) parameterWhen the application command is executed
5082Socket ID input by Ethernet command is out of range.Continue to runModify application command parametersWhen the application command is executed
5083Failed to create TCP serverContinue to runCheck if the connection is fullWhen the application command is executed
5084Failed to create linkContinue to runCheck if the connection is fullWhen the application command is executed
5086The socket ID used by the Ethernet command is not configured by the upper computer or is not enabled after configuration.Continue to runCheck the Ethernet configuration of upper computerWhen the application command is executed
5087SOCRECV command reception timeoutContinue to run

1. Check if the network connection is normal.

2. Check whether there is data sent by the network peer.

When the application command is executed
5088The SOCMTCP command specifies that the socket uses the configuration mode of a non-TCP clientContinue to runCheck the Ethernet configuration of upper computerWhen the application command is executed
5089When configuring the TCP server for the Ethernet socket, specify the local port as 502Continue to runPort 502 has been occupied internally, please modify the local port.When the application command is executed
508AThe UDP port is specified as 1092Continue to run

UDP port: 1092 is occupied by the system and cannot be used,

please modify the local port number.

When the application command is executed
5090Network cable connection exceptionContinue to runCheck if the network cable is connectedWhen the application command is executed