Understand the Modbus protocol from the ground up - perfect for beginners and professionals
Modbus is a serial communication protocol originally published by Modicon (now Schneider Electric) in 1979 for use with programmable logic controllers (PLCs). It has since become a de facto standard in industrial automation and is one of the most widely used protocols for connecting electronic devices in factories, power plants, and building automation systems.
Modicon publishes the original Modbus specification for serial communication (RTU/ASCII)
Modbus TCP/IP is released, bringing Modbus to Ethernet networks
Modbus Organization takes over protocol management and maintenance
Still the most widely used industrial protocol worldwide, with millions of devices deployed
Modbus uses a Master/Slave (also called Client/Server) architecture. The master device initiates requests, and slave devices respond with the requested data or perform the requested action.
Each slave device has a unique address (1-247). The master uses this ID to target a specific device. ID 0 is reserved for broadcast messages.
A numeric code (1-127) that tells the slave what operation to perform - read coils, write registers, etc.
Contains the register addresses, quantities, and values depending on the function code being used.
CRC (RTU) or LRC (ASCII) checksum for serial. TCP uses the built-in TCP/IP error detection.
This example reads 10 holding registers starting from address 0 on slave ID 1
Modbus comes in two primary variants. Both carry the same type of data, but the transport layer and frame format differ.
| Aspect | Modbus RTU | Modbus TCP/IP |
|---|---|---|
| Physical Layer | RS-485 / RS-232 serial | Ethernet (Cat5/Cat6) |
| Network Topology | Daisy chain (bus) | Star (switch-based) |
| Speed | Up to 115,200 baud | 10/100/1000 Mbps |
| Max Devices | 247 per bus | Virtually unlimited |
| Cable Distance | Up to 1,200m (RS-485) | 100m per segment |
| Error Detection | CRC-16 checksum | TCP/IP built-in |
| Masters | Single master only | Multiple clients |
| Default Port | COM port (serial) | TCP port 502 |
| Best For | Simple, short-distance, cost-effective setups | Complex networks, long distance, high speed |
TCP adds a 7-byte MBAP header and removes the CRC (TCP/IP handles error checking)
Function codes tell the slave device what action to perform. Here are the most commonly used function codes, all supported by ModbusBB.
Read the ON/OFF status of discrete outputs (coils). Returns a bit array.
Read the ON/OFF status of discrete inputs. Similar to FC 01 but for read-only inputs.
Read the contents of holding registers (read/write 16-bit values). The most commonly used function.
Read the contents of input registers (read-only 16-bit values). Used for sensor data.
Set a single coil to ON (0xFF00) or OFF (0x0000).
Write a single 16-bit value to a holding register.
Set multiple coils to ON/OFF in a single request. More efficient than multiple FC 05 calls.
Write to multiple consecutive holding registers in one request. Essential for 32-bit values.
When a slave device cannot process a request, it returns an exception response with an error code:
The function code is not supported by the slave device.
The requested register address does not exist on the device.
The value in the request is not acceptable (e.g., out of range).
An internal error occurred in the slave while processing the request.
Modbus organizes data into four types of memory areas. Understanding these is essential for working with any Modbus device.
Address Range: 00001 - 09999
Type: Single bit (ON/OFF)
Access: Read/Write
Function Codes: FC 01, 05, 15
Example: Relay outputs, motor start/stop, valve open/close
Address Range: 10001 - 19999
Type: Single bit (ON/OFF)
Access: Read Only
Function Code: FC 02
Example: Limit switches, push buttons, sensor status
Address Range: 30001 - 39999
Type: 16-bit word (0 - 65535)
Access: Read Only
Function Code: FC 04
Example: Temperature sensors, analog inputs, measured values
Address Range: 40001 - 49999
Type: 16-bit word (0 - 65535)
Access: Read/Write
Function Codes: FC 03, 06, 16
Example: Setpoints, configuration, control parameters
While Modbus registers are 16-bit, real-world values often require different data formats. ModbusBB supports all of these:
Single register. Unsigned (0 to 65,535) or signed (-32,768 to 32,767). Most common format.
Two consecutive registers combined. Unsigned (0 to ~4.29 billion) or signed. Byte order matters.
Two registers forming a 32-bit floating point value. Used for temperatures, pressures, flow rates.
For 32-bit values, the byte order (ABCD, DCBA, BADC, CDAB) varies by manufacturer. ModbusBB supports all.
Modbus is used across many industries. Here are some of the most common scenarios where ModbusBB helps engineers and technicians.
Read power meters, solar inverters, battery management systems, and energy monitoring devices. Track voltage, current, power factor, and kWh consumption.
Communicate with PLCs, VFDs (variable frequency drives), and motor controllers. Read status, write setpoints, and control production lines.
Monitor and control HVAC systems, chillers, boilers, and environmental sensors. Read temperatures, humidity, and control dampers.
Monitor flow meters, level sensors, pump controllers, and treatment systems. Track flow rates, tank levels, and chemical dosing.
Test new Modbus devices during development. Verify register maps, validate responses, and debug communication issues.
Collect data from field devices for SCADA systems, historians, and monitoring dashboards. Log values over time for trend analysis.
These curated videos will help you understand Modbus visually. Great for beginners and as a refresher for experienced users.
A comprehensive introduction to the Modbus protocol, covering the basics of how devices communicate in industrial automation.
Learn how to get started with Modbus communication, including setup procedures and configuration basics.
Download ModbusBB and use it alongside these tutorials to practice reading and writing to Modbus devices. The 30-day free trial gives you full access to all features.
Download Free TrialKey terms you'll encounter when working with Modbus devices and ModbusBB.
Download ModbusBB and start communicating with your Modbus devices today.