Modbus Slave ID & TCP Unit Identifier Guide (0–255 Addressing)
One of the most frequent causes of silent Modbus timeouts and Exception 0x0B (Gateway Target Device Failed to Respond) errors is a mismatch in the single-byte station identifier: the Slave Address on RS-485 RTU/ASCII or the Unit Identifier inside the Modbus TCP MBAP header.
With ModbusSimulator, you can simulate any Unit ID from 1 to 255 in Modbus Slave Simulator mode and trace exact MBAP and RTU hex bytes in Master mode—free for 30 days on Windows 10/11.
1. Modbus Address Allocation Table (0–255)
| Address Range (Dec) | Hex Range | Modbus RTU / ASCII Role | Modbus TCP Unit ID Role |
|---|---|---|---|
0 | 0x00 | Broadcast (write-only, no reply) | Often accepted as local server or broadcast |
1 – 247 | 0x01 – 0xF7 | Unicast Slave / Server addresses | Routed to downstream RS-485 serial slaves or sub-modules |
248 – 254 | 0xF8 – 0xFE | Reserved by Modbus specification | Reserved / vendor-specific diagnostic sub-units |
255 | 0xFF | Reserved (do not assign on RS-485) | Standard “direct TCP server” Unit Identifier per spec |
2. Why Native Modbus TCP Uses 0xFF (255) — Yet Many PLCs Require 1
In the 7-byte Modbus TCP MBAP header (Transaction ID [2B], Protocol ID [2B], Length [2B], Unit ID [1B]), IP addressing already identifies the target host. The official Modbus TCP/IP specification recommends setting Unit ID to 0xFF (255) when talking directly to a standalone TCP device with no serial bridge behind it.
- Vendor Reality Check: Many industrial PLCs, VFDs, and energy meters reject
255and strictly expectUnit ID = 1(or their configured internal slot/station number), returning a timeout or Exception 0x0A if you poll255. - TCP-to-RTU Gateways: When a Moxa, HMS Anybus, or Advantech gateway bridges Ethernet port 502 to RS-485, it strips the MBAP header, places the Unit ID byte at byte 0 of the RTU frame, appends CRC-16, and waits for that exact RTU Slave ID.
- Echo Verification: A compliant slave always echoes the exact Slave ID / Unit ID back in its response; any mismatch causes SCADA drivers like Modbus Poll or Radzio Modbus Simulator to drop the packet.
3. Broadcast Address 0 Rules (And Why Reads Fail)
Sending a request to Slave ID 0 on an RS-485 bus instructs every connected slave to execute the command simultaneously without transmitting a reply (preventing RS-485 bus collisions). Only write function codes (FC 05, FC 06, FC 15, FC 16) work on address 0; polling FC 03 on ID 0 will always time out.
Simulate Multiple Modbus Slave IDs (1–255) Without Hardware
Replace aging ModRSsim2 tools—run concurrent TCP and RTU Slave IDs, inspect live MBAP Unit IDs, and test gateway routing on Windows 10/11.
Download Free 30-Day TrialFrequently Asked Questions
What is the valid Modbus RTU Slave ID range?
Valid unicast Modbus RTU/ASCII Slave IDs are 1 through 247 (0x01–0xF7). Address 0 is write-only broadcast, and 248–255 are reserved.
What Unit ID should I use for Modbus TCP (1 vs 255 / 0xFF)?
The Modbus TCP specification defines 0xFF (255) for direct TCP servers, but many PLCs and meters require Unit ID 1. Always check vendor documentation and test both in Modbus TCP Simulator.
How does a Modbus TCP-to-RTU gateway use the Unit Identifier?
The gateway copies the MBAP Unit ID byte directly into the RTU Slave Address byte on the RS-485 line, routing your TCP poll to the matching physical serial device.
How can I test multiple Modbus Slave IDs on one PC?
Launch ModbusSimulator on Windows 10/11 in Slave/Server mode to simulate multiple Unit IDs simultaneously during a free 30-day trial—no physical PLC needed.