A Brief Walkthrough of Modbus with Diagrams

Tables & Flowcharts of Modbus

Yu-Cheng (Morton) Kuo
Nerd For Tech
3 min readNov 18, 2023

--

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:

  1. Start (always 1 bit)
  2. Slave Address (1 byte)
  3. Function Code 0x10 (1 byte)
  4. Starting Address (2 bytes)
  5. Quantity of Registers (2 bytes)
  6. CRC Check (2 bytes)
  7. 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) |

Figure: Delicate diagram from Modbus Function Command Formats

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!

(7) CRC

--

--

Yu-Cheng (Morton) Kuo
Nerd For Tech

CS/DS blog with C/C++/Embedded Systems/Python. Embedded Software Engineer. Email: yc.kuo.28@gmail.com