A Brief Walkthrough of Modbus with Diagrams
Tables & Flowcharts of Modbus
Modbus is a communication protocol commonly used in industrial automation and control systems. Here, we leverage a few diagram to walk you through the main ideas of Modbus protocol quickly.
Outline
(1) Data Model Blocks / Memory Areas
(2) Flowcharts of Modbus Master and Slave
(3) Modbus Breakdown in the Context of the TCP/IP Five-Layer Model
(4) Framing and Deframing in Modbus
(5) Modbus function codes
(6) Modbus Commands and Responses Data Frame
(7) CRC
(8) References
(1) Data Model Blocks / Memory Areas
(2) Flowcharts of Modbus Master and Slave
(3) Modbus Breakdown in the Context of the TCP/IP Five-Layer Model
(4) Framing and Deframing in Modbus
(5) Modbus function codes
(6) Modbus Commands and Responses Data Frame
Now, let’s dive into the details regarding data frames of Modbus function commands and responses:
For a Modbus RTU Read Multiple Registers (Read Holding Registers) [0x03] request:
- Start (always 1 bit)
- Slave Address (1 byte)
- Function Code 0x10 (1 byte)
- Starting Address (2 bytes)
- Quantity of Registers (2 bytes)
- CRC Check (2 bytes)
- End (1 or 2 bits)
| Start (always 1 bit) | Slave Address (1 byte) | Function Code [0x03] (1 byte) | Starting Address (High) (1 byte) | Starting Address (Low) (1 byte) | Quantity (High) (1 byte) | Quantity (Low) (1 byte) | CRC Low (1 byte) | CRC High (1 byte) | End (1 or 2 bits) |
Modbus Function Command Formats really did a great job illustrating all the data frames of commands (of the master device) and responses (of the slave devices) of all the Modbus functions. Check it out!