Modbus Tutorial
From beginner to proficiency, systematically learn the principles of Modbus protocol, message formats, debugging methods, and practical applications
Quick Start
Detailed explanation of Modbus protocol
Learn the principles, frame formats, function codes, and register mappings of Modbus RTU, TCP, and ASCII protocols
Start learning →Online Tools
Free access to online tools such as serial port debugging, TCP debugging, CRC calculation, and packet parsing
Open the tool →Download Materials
Download technical materials such as protocol manuals, wiring diagrams, selection tables, industry white papers, and more
Download materials →Protocol tutorial
Modbus RTU
- RTU frame format and timing
- CRC check calculation
- Master-slave communication mechanism
- Common error handling
Modbus TCP
- MBAP message header structure
- TCP connection establishment
- Transaction identifier
- Difference from RTU
Modbus ASCII
- ASCII frame format
- LRC check calculation
- Start/End Character
- Application Scenarios
Detailed explanation of function codes
- 01/02: Read-write coil
- 03/04: Read and write registers
- 05/06: Write a single entry
- 15/16: Write multiple
Debugging in Practice
Serial Port Debugging
- Serial port parameter setting
- Message sending and receiving
- Response timeout handling
- Common error codes
TCP debugging
- IP and port settings
- TCP connection test
- Packet capture and analysis
- Network fault diagnosis
CRC calculation
- CRC-16 algorithm
- Online calculation tool
- Check code verification
- Common Mistakes
message parsing
- Automatically parse messages
- Field Description
- Error code explanation
- Case Analysis
common problems
What is the difference between Modbus RTU and TCP?
RTU uses serial communication (RS485/RS232), with a frame format consisting of address, function code, data, and CRC check; TCP uses Ethernet communication, with a frame format consisting of an MBAP header and PDU, and does not require CRC check.
How to calculate the Modbus CRC check code?
CRC-16 uses a polynomial of 0x8005 and an initial value of 0xFFFF. After calculating each byte, it is XORed with 0xFFFF. You can use our online CRC calculation tool to automate the calculation.
What is the difference between Modbus function codes 03 and 04?
Function code 03 reads the holding register (readable and writable), while function code 04 reads the input register (read-only). The holding register is used for parameter settings, while the input register is used for real-time data.
How to solve the Modbus communication timeout issue?
Check whether the serial port parameters (baud rate, data bits, stop bits, parity bits) match, whether the wiring is correct, whether the slave address conflicts, and appropriately increase the timeout period.
Need help?
If you encounter any issues while learning or using Modbus, please feel free to contact our technical support team.