Modbus RTU and Modbus TCP carry the same PDU — the same function codes, the same register tables, the same exception codes. Everything below the PDU is different. That is why a working RTU register map usually transfers to TCP unchanged, while everything about the transport does not.
| Modbus RTU | Modbus TCP | |
|---|---|---|
| Physical layer | RS-485 (sometimes RS-232) | Ethernet |
| Addressing | Slave ID 1–247 | Unit ID in MBAP header (essentially cosmetic) |
| Error detection | CRC-16, computed over the whole frame | None — TCP handles integrity |
| Framing | 3.5 character silent interval | MBAP header with explicit length |
| Default port | n/a | 502 |
| Max devices per segment | 32 unit loads (247 with repeaters) | Limited by network, not protocol |
| Typical latency | Milliseconds to tens of milliseconds | Sub-millisecond on LAN |
| Distance | 1200 m at low baud rates | Network-dependent |
| Concurrent connections | One master, sequential polling | Many clients, concurrent |
Identical request — read 10 holding registers starting at address 0, slave 1.
Modbus RTU (8 bytes):
01 03 00 00 00 0A C5 CD
^^ ^^ ^^^^^ ^^^^^ ^^^^^
ID FC addr qty CRC
Modbus TCP (12 bytes):
00 01 00 00 00 06 01 03 00 00 00 0A
^^^^^ ^^^^^ ^^^^^ ^^ ^^^^^^^^^^^^^^^^^
txn proto len unit PDU (identical)
Four observations that save real debugging time:
03 00 00 00 0A appears in both. Only the envelope changed.proto is always 0x0000. A non-zero value means the frame is not Modbus.len counts the bytes after itself — unit ID plus PDU. In this example, 6.RTU has no length field, so it relies on silence to find frame boundaries. The standard says 3.5 character times at the configured baud rate. At 9600 baud with 11 bits per character that is roughly 4 ms.
This has two consequences:
TCP replaces silence with an explicit length, so frames can arrive in any number of TCP segments and still be reassembled correctly. That is the structural reason TCP is easier to implement.
In RTU, the slave ID is the first byte and the device genuinely filters on it. Address 0 is the broadcast address — every slave acts, none replies.
In TCP, the unit ID in the MBAP header is often ignored. A direct-to-Ethernet device usually accepts any value. Its purpose appears when a gateway sits in the middle: the unit ID tells the gateway which RS-485 slave the request is for. Setting unit ID 1 when your target is slave 17 behind a gateway produces either no reply or exception 0x0B.
Choose Modbus TCP when: you are building something new, the devices are on Ethernet, you need multiple clients, or you want to debug with Wireshark. A plain TCP connection is dramatically easier to troubleshoot than a shared serial bus.
Choose Modbus RTU when: the sensor only exists with RS-485 (extremely common for power meters, VFDs, temperature controllers, and battery management systems), the run is long, or the environment is electrically noisy. RS-485 differential signalling survives conditions that would corrupt Ethernet.
In practice most installations are both: RTU devices on a serial segment, a gateway or an industrial PC converting to TCP, and the SCADA layer speaking TCP. The gateway is where nearly all integration bugs live.
When RTU works locally but not through a gateway:
1 on a gateway configured for 17 is a dead end.You can practise both ends on ModbusLab: the TCP slave accepts real connections on port 502, and the message lab lets you encode the same PDU as RTU, ASCII, or TCP and compare the three frames byte by byte.