Modbus
lastmod 2025-11-06created 2017-03-2626 edits
Modbus is a serial communications protocol originally published by Modicon (now Schneider Electric) in 1979 for use with its programmable logic controllers (PLCs). Simple and robust, it has since become a de facto standard communication protocol, and it is now a commonly available means of connecting industrial electronic devices. The main reasons for the use of Modbus in the industrial environment are:
- developed with industrial applications in mind
- openly published and royalty-free
- easy to deploy and maintain
- moves raw bits or words without placing many restrictions on vendors
Projects
Simulators
- QModMaster
- pyModSlave
- Diagslave
- Modbus Tools (mbtools)
Data types
| Type | Description | Value | Example uses |
| Coil | Digital output (read/write) | 0 or 1 | Motor ON/OFF |
| Discrete Input | Digital input (read-only) | 0 or 1 | Button state |
| Holding Register | Analog output (read/write) | 16bit integer | Speed setpoint |
| Input Register | Analog input (read-only) | 16bit integer | Temperature reading |
Terms
Origin of the term Coil
It means Coil = Digital Output (DO).
The term "coil" comes from the old days of relays:
Today it is electronic, but the term is still used.
Function Code
Official standard Function Codes (Public)
The most commonly used standard codes:
| FC | Name | Description |
| 01 | Read Coils | Read coil status |
| 02 | Read Discrete Inputs | Read discrete inputs |
| 03 | Read Holding Registers | Read holding registers |
| 04 | Read Input Registers | Read input registers |
| 05 | Write Single Coil | Write a single coil |
| 06 | Write Single Register | Write a single register |
| 15 | Write Multiple Coils | Write multiple coils |
| 16 | Write Multiple Registers | Write multiple registers |
Extended Function Codes
Standard codes for additional functions:
| FC | Name | Description |
| 07 | Read Exception Status | Read exception status |
| 08 | Diagnostics | Diagnostics |
| 11 | Get Comm Event Counter | Communication event counter |
| 17 | Report Slave ID | Report slave ID |
| 20 | Read File Record | Read file record |
| 21 | Write File Record | Write file record |
| 22 | Mask Write Register | Mask write register |
| 23 | Read/Write Multiple Registers | Read/write multiple registers |
| 43 | Read Device Identification | Read device identification |
User-defined range
Can be defined by manufacturers or for special purposes:
FC 65-72, 100-110: user-definable range
See also
Favorite site
- Wikipedia (en) Modbus
- Getting started with Modbus
- Understanding the Modbus protocol
- Modbus Master C++ Library: Examples
- Getting started with Modbus - NI
- MODBUS communication: a brief explanation of Modbus communication worth knowing - YouTube
- How to configure a Modbus Gateway : Naver Blog
Basics
- [Recommended] What is the Modbus Protocol? : Naver Blog
- [Recommended] Information archive - Modbus
- [Recommended] (Protocol) Modbus
- [Recommended] ModBus : Naver Blog