Modbus in one minute
Modbus is a request/response protocol at the application layer, described by its own specification as "the industry's serial de facto standard since 1979" [1]. A client sends a request with a function code. A server answers. On serial lines the same roles are called master and slave [3].
All Modbus data lives in four tables [1]:
| Table | Object | Access | Typical content |
|---|---|---|---|
| Discrete inputs | 1 bit | Read-only | Status contacts, alarm states |
| Coils | 1 bit | Read/write | Relays, start/stop |
| Input registers | 16-bit word | Read-only | Measured values |
| Holding registers | 16-bit word | Read/write | Setpoints, configuration, often measured values too |
The common function codes are 01 Read Coils, 02 Read Discrete Inputs, 03 Read Holding Registers, 04 Read Input Registers, 05 Write Single Coil, 06 Write Single Register, 15 Write Multiple Coils and 16 Write Multiple Registers [1]. RTU and TCP use them unchanged. Only the wrapper around them differs.
Modbus TCP vs RTU at a glance
| Modbus RTU | Modbus TCP | |
|---|---|---|
| Physical layer | Serial: RS-485 two-wire as the common case, four-wire optional, or RS-232 [3] | Ethernet or any IP network |
| Roles | One master, up to 247 slaves on a bus, one request at a time | Many clients and servers, several transactions in flight |
| Addressing | Slave address 1–247, 0 = broadcast [3] | IP address and port 502; unit identifier for devices behind a gateway [2] |
| Frame | Address + PDU + CRC-16 | 7-byte MBAP header + PDU |
| Error check | CRC in every frame | None in Modbus; TCP and Ethernet checksums do the job [2] |
| End of a message | Silence of 3.5 characters | Length field in the header |
| Largest frame | 256 bytes | 260 bytes [1] |
| Speed | 9,600 and 19,200 bit/s required, 19,200 the default [3] | 10, 100 or 1,000 Mbit/s |
| Reach | Up to 1,000 m at 9,600 bit/s with AWG26 or thicker, no repeater [3] | 100 m per copper Ethernet segment [5], more with switches or fiber |
| Devices | 32 per segment without repeater, always allowed [3] | Limited by the IP network |
| Security | None | None in the base protocol; Modbus Security over TLS on port 802 [4] |
The same request in two frames
Task: read 2 holding registers starting at address 0 (function 03).
Modbus RTU, 8 bytes: 01 03 00 00 00 02 C4 0B
| Bytes | Meaning |
|---|---|
01 |
Slave address 1 |
03 |
Function code: read holding registers |
00 00 |
Starting address 0 |
00 02 |
Quantity: 2 registers |
C4 0B |
CRC-16, low byte first [3] |
Modbus TCP, 12 bytes: 00 01 00 00 00 06 FF 03 00 00 00 02
| Bytes | Meaning |
|---|---|
00 01 |
Transaction identifier, copied into the reply |
00 00 |
Protocol identifier, 0 = Modbus |
00 06 |
Length: 6 more bytes follow |
FF |
Unit identifier: none needed, the device is addressed by its IP. Behind a gateway this byte would be 01. [2] |
03 00 00 00 02 |
The same PDU as above |
The PDU in the middle is identical. A gateway translates between the two by swapping the wrapper. All fields are big-endian [1][2]. Only the RTU CRC goes low byte first.
Timing on the serial line
An RTU character has 11 bits: 1 start bit, 8 data bits, 1 parity bit and 1 stop bit. Without parity it needs 2 stop bits. Even parity is the default [3]. Frames are separated by at least 3.5 character times of silence. A gap of more than 1.5 character times inside a frame makes it invalid. Above 19,200 bit/s the specification recommends fixed values of 750 µs and 1.75 ms instead [3].
What that means in practice, at 19,200 bit/s:
- One character: 11 bits ÷ 19,200 bit/s ≈ 0.57 ms.
- Request for 125 registers, the most function 03 allows: 8 bytes ≈ 4.6 ms.
- Reply: 1 address + 1 function + 1 byte count + 250 data + 2 CRC = 255 bytes ≈ 146 ms.
- Plus two silent gaps of about 2 ms each and the device's own processing time.
So one full read takes around 150 ms before the device has done any work. Poll 32 devices that way and one round takes about five seconds. At 9,600 bit/s, double it. The Modbus part of the same reply over 100 Mbit/s Ethernet, 259 bytes, occupies the wire for about 21 µs. RTU is fine for a few values per second from a handful of devices. It becomes the bottleneck when many devices share one bus.
Gateways, unit IDs and "RTU over TCP"
A Modbus gateway has Ethernet on one side and RS-485 on the other. The TCP client puts the serial address in the unit identifier. The gateway forwards the request onto the serial line and returns the reply [2].
Some devices and converters use a variant often called RTU over TCP: the complete RTU frame, CRC included, inside a TCP connection without an MBAP header. It is not part of the Modbus TCP implementation guide. A Modbus TCP client and an RTU-over-TCP device do not understand each other, even on the same port. Check the manual before you wire.
Which one should you use?
Choose Modbus RTU when devices only have a serial port, they sit close together in a cabinet or analyzer container, there are few of them and one daisy-chained cable is welcome.
Choose Modbus TCP when devices are already on Ethernet, several systems need the same data, such as SCADA, a historian and a gateway, you need more speed or the distances exceed a serial bus.
Mix them with a gateway: RTU inside the cabinet, TCP from the cabinet to the control room.
Pitfalls that cost a day on site
- Off-by-one register numbers. Manuals often list "40001". The protocol counts from 0. In the specification's own words, items "numbered 1-16 are addressed as 0-15" [1].
- 32-bit values. The standard only defines 16-bit registers. Floats and 32-bit counters span two registers. The word order is up to the device maker. If a value looks absurd, swap the words.
- Serial settings. Baud rate, parity and stop bits must match exactly on every device on the bus.
- Two masters on one RTU bus. They collide. RTU allows one master.
- Unit identifier on TCP. Devices connected directly often ignore it. Gateways rely on it.
- Polling too fast. Devices need processing time between requests. Respect the response timeout.
- No security. Modbus has no authentication. Keep it off the internet and inside segmented networks.
Modbus and gas analyzers
Many gas analyzers offer Modbus next to their 4–20 mA outputs. That is the main reason to use it: a 4–20 mA output carries one value, while a Modbus read can carry every measured component plus status words for fault, maintenance and calibration. A SCADA system that only reads the analog signal sees a number. One that reads Modbus also sees whether that number can be trusted.
Where Factory fits
The Factory connector does not speak Modbus today. It reads Fresenius Instruments gas analyzers over their serial line, through USB, RS-232, RS-485 or a serial-to-Ethernet converter, in each analyzer's own format. It sends every reading to Factory over MQTT 5 with TLS. Twelve analyzer types work that way today. See the connector.
Coming 2027: Factory Studio reads devices from other makers over Modbus RTU and Modbus TCP, next to OPC UA, Siemens S7, MQTT and BACnet. Flow meters, PLCs and drives then sit on the same screen as your analyzers.
Sources
- Modbus Organization, Modbus Application Protocol Specification V1.1b3, 26 April 2012, sections 4 and 6. modbus.org
- Modbus Organization, Modbus Messaging on TCP/IP Implementation Guide V1.0b, 24 October 2006, section 3.1.3 and 4.4. modbus.org
- Modbus Organization, Modbus over Serial Line Specification and Implementation Guide V1.02, 20 December 2006, sections 2 and 3. modbus.org
- Modbus Organization, Modbus Security Protocol (TLS, X.509v3 certificates, port 802). modbus.org
- IEEE 802.3, Standard for Ethernet (100 m segment length for twisted-pair copper).
FAQ
Is Modbus TCP faster than Modbus RTU?
On the wire, yes, by orders of magnitude: Ethernet typically runs at 100 Mbit/s or more, RTU typically at 9,600 or 19,200 bit/s. Reading 125 registers takes about 150 ms on a 19,200 bit/s RTU line. In practice the device's own response time often matters more than the link.
Can Modbus RTU and Modbus TCP devices talk to each other?
Yes, through a gateway. It takes the request from the TCP side, uses the unit identifier as the serial address and passes the unchanged request onto the RS-485 line. The reply goes back the same way.
Which port does Modbus TCP use?
TCP port 502, reserved for Modbus. Modbus Security, the TLS-protected variant, uses port 802.
Is Modbus RTU the same as RS-485?
No. Modbus RTU is the protocol, RS-485 the electrical layer underneath. Modbus RTU also runs over RS-232. RS-485 also carries other protocols. See RS-485 and Modbus.
Does Modbus have security built in?
Classic Modbus RTU and TCP have no authentication or encryption. Keep them inside segmented control networks. Where devices support it, Modbus Security adds TLS with X.509 certificates.
Does Factory support Modbus?
Not yet. Today the Factory connector reads Fresenius Instruments analyzers in their own serial format. Modbus RTU and TCP for devices from other makers come with Factory Studio, Coming 2027.
Fresenius Instruments editorial team
We build gas analyzers in Herten, Germany, and the software that connects them. Write to us
