

This chapter mainly introduces the MODBUS TCP communication protocol and free format communication protocol based on Ethernet.
MODBUS TCP combines the physical Ethernet network and the network standard TCP/IP with MODBUS as the application protocol standard for data representation. The MODBUS TCP communication message is encapsulated in Ethernet TCP/IP packets, with the maximum length of a MODBUS protocol frame being 256 bytes.
In the MODBUS TCP/IP communication system, there are two types of devices: MODBUS TCP/IP clients and server devices.
MODBUS Client
The client (TCP Client) actively initiates a connection request to the server (TCP Server). Once the connection is successfully established, only the client can actively initiate communication requests.
When the Ethernet model acts as a MODBUS TCP client, it establishes a TCP connection via the S_OPEN command and initiates MODBUS requests through the M_TCP command.
MODBUS Server
The server actively listens on port 502, waiting for client connection requests. Once the connection is successfully established, it responds to data communication requests that comply with the Modbus TCP protocol specifications.
The Ethernet model defaults to enabling this service upon power-up, with a maximum response of no more than 4 TCP connections.
MODBUS Communication Function Codes
Taking the Xinjie PLC as an example, the Ethernet model supports the following Modbus communication function codes:

Free communication based on Ethernet is divided into two major categories: TCP and UDP. When the Ethernet model uses TCP for communication, it can act as a TCP client or a TCP server.
1. As a TCP client, actively establish a TCP connection with the TCP server and bind the socket ID.
2. As a TCP server, wait for the TCP client to establish a TCP connection and bind the socket ID.
3. Using UDP, listen on a specified local port and bind the socket ID.
Based on the above three forms, free communication over Ethernet can be achieved. Free format communication transmits data in the form of data blocks, limited by the PLC cache, with a maximum of 1000 bytes of data sent and received at one time.
Key Parameters of Free Format Communication
Data Buffering Method: 8-bit, 16-bit
1. When selecting the 8-bit buffer format for communication, the high byte of the register is invalid during the communication process, and the PLC only uses the low byte of the register to send and receive data.
2. When selecting the 16-bit buffer format for communication, the PLC stores received data first in low byte and then in high byte; when sending data, it sends the low byte first and then the high byte.
3. If the length of the received data packet exceeds the set receiving length, the data is stored in 16-bit storage format.
Disclaimer: This article is reproduced from the internet, and the copyright belongs to the original author. If there are any copyright issues, please contact us to delete it in a timely manner. Thank you!
2021 Electrical Beginner Exam Question Bank Complete Version (Includes Answers)
Trouble with inverter faults? Just one click will do!
Want to brush through all electrical exam questions with one click? Don’t you have this tool yet?
Which of the five major electrical drawing software (CAD, Eplan, CADe_simu…) do you pick?
The latest electrical CAD drawing software, with a super detailed installation tutorial!
The latest electrical drawing software EPLAN, with a super detailed installation tutorial!
Common issues for beginners using S7-200 SMART programming software (with download link)
Comprehensive electrical calculation EXCEL sheets, automatically generated! No need to seek help for electrical calculations!
Bluetooth headphones, electrical/PLC introductory books given away? Come and claim your electrical gifts!
Basic skills in PLC programming: Ladder diagrams and control circuits (with 1164 practical cases of Mitsubishi PLC)
Still can’t understand electrical diagrams? Grab the basics of electrical drawing and simulation software, quickly get started with theory and practice!
12 free electrical video courses, 10GB of software/e-book materials, and 30 days of free live electrical courses are being given away!
