How to Configure Modbus RTU Over RS-485: Step-by-Step

By | April 1, 2026

Modbus RTU over RS-485 is the most common serial communication setup in industrial automation. It connects PLCs, sensors, drives, meters, and other field devices on a simple two-wire bus.

The protocol itself is straightforward. But getting it to work reliably depends on getting the details right — wiring, termination, addressing, baud rate, parity, and register mapping all need to match across every device on the bus.

This guide walks you through the full process. From physical wiring to software configuration, you will learn what to set, why it matters, and what goes wrong when it is done incorrectly.

1. What Is Modbus RTU and Why RS-485

Modbus was developed in 1979 by Modicon (now Schneider Electric) for communication between PLCs. It is an open, royalty-free protocol — any manufacturer can implement it without licensing fees.

Modbus RTU (Remote Terminal Unit) is the serial variant that uses binary encoding. It is more compact and faster than Modbus ASCII, which is why RTU is the default choice for most industrial applications.

RS-485 is the physical layer standard used to carry Modbus RTU signals. It was chosen for several reasons:

  • Multi-drop: One master can communicate with up to 32 slaves on a single bus (up to 256 with repeaters).
  • Long distance: RS-485 supports cable lengths up to 1200 meters (4000 feet) depending on baud rate.
  • Noise resistance: It uses differential signaling (two wires, A and B), which rejects common-mode noise — critical in electrically noisy industrial environments.
  • Half-duplex: Communication alternates between send and receive on the same wire pair, keeping wiring simple.

2. RS-485 Wiring and Bus Topology

Bus Topology

Modbus RTU over RS-485 uses a daisy-chain bus topology. The cable runs from the master to the first slave, then to the second slave, and so on. The last device on the bus is the end of the line.

Do not use star or stub wiring. Star connections create signal reflections that corrupt data. If you must connect a device off the main bus, keep the stub cable as short as possible — under 1 meter is best.

Cable Requirements

ParameterRecommendation
Cable typeShielded twisted pair (STP), 24 AWG or thicker
Characteristic impedance120 ohms (matches termination resistor)
Number of pairs1 pair for half-duplex (A and B), plus ground
ShieldConnect shield to ground at one end only (to avoid ground loops)
Max cable length1200 m at 9600 baud, shorter at higher baud rates

Pin Connections

RS-485 uses two signal wires plus a reference ground:

SignalLabelFunction
A (−)D− or TxD−/RxD−Inverting (negative) signal line
B (+)D+ or TxD+/RxD+Non-inverting (positive) signal line
GNDCommonSignal reference ground — always connect this

⚠️ Warning: There is no universal standard for A/B labeling. Some manufacturers swap A and B. Always check the device manual. If communication fails with no obvious cause, try swapping A and B — this is one of the most common wiring mistakes.

3. Termination and Biasing

Line Termination

Place a 120-ohm termination resistor at each end of the RS-485 bus — one at the master and one at the last slave. This matches the cable impedance and prevents signal reflections.

Do not add termination resistors in the middle of the bus or on every device. Only the two physical ends of the cable need them.

Biasing Resistors

When the bus is idle (no device transmitting), the A and B lines float to an undefined state. This can cause slaves to interpret noise as valid data.

Biasing resistors force the bus to a known idle state:

  • Pull-up resistor (390–560 ohms) from B+ to +5V
  • Pull-down resistor (390–560 ohms) from A− to GND

Many Modbus masters and RS-485 converters have built-in biasing that can be enabled via a DIP switch or jumper. Check your hardware before adding external resistors.

💡 Pro Tip: If you see random garbage data or framing errors when no device is transmitting, the bus likely needs biasing resistors. This is especially common on long cable runs or buses with fewer than 5 devices.

4. Step-by-Step: Configure the Master

The master (client) initiates all communication. It sends requests and waits for responses. Only one master is allowed on a Modbus RTU bus.

Serial Port Settings

All devices on the bus must use identical serial port settings:

ParameterCommon ValuesNotes
Baud rate9600, 19200, 38400, 1152009600 is the most common default
Data bits8Always 8 for Modbus RTU
ParityEven (recommended), None, OddEven parity is the Modbus standard default
Stop bits1 (with parity) or 2 (without parity)If parity = None, use 2 stop bits to maintain 11-bit character frame

Master Configuration

ParameterSettingNotes
ModeRTUNot ASCII
Response timeout300–1000 msTime to wait for slave response before declaring error
Retry count2–3Number of retries on timeout or CRC error
Poll interval100–1000 msTime between successive polls to the same slave
Scan orderSequentialPoll slave 1, then slave 2, etc. in round-robin

5. Step-by-Step: Configure the Slave

Each slave (server) device on the bus must be configured with a unique address and matching serial settings.

Slave Settings

ParameterSettingNotes
Slave address1 to 247Must be unique on the bus. Address 0 is reserved for broadcast.
Baud rateMust match masterAll devices share the same baud rate
ParityMust match masterMismatch causes every message to fail
Data bits / Stop bitsMust match masterMust be identical across the entire bus

What the Slave Does

  • Listens to every message on the bus.
  • Checks the slave address field in each message.
  • Ignores messages addressed to other slaves.
  • Processes messages addressed to itself and sends a response.
  • Accepts broadcast messages (address 0) but does not respond to them.

⚠️ Warning: Never assign the same address to two slaves on the same bus. Both devices will try to respond at the same time, causing bus collisions and corrupted data.

6. Modbus Data Model: Register Types Explained

Modbus organizes all data into four register types. Each type has its own address range and access rules.

Register TypeLegacy PrefixAccessSizeFunction Code (Read)Function Code (Write)
Coils0xxxxRead/Write1 bitFC 01FC 05 (single), FC 15 (multiple)
Discrete Inputs1xxxxRead-Only1 bitFC 02
Input Registers3xxxxRead-Only16-bit wordFC 04
Holding Registers4xxxxRead/Write16-bit wordFC 03FC 06 (single), FC 16 (multiple)

In practice, most devices map everything to holding registers (4xxxx). You will use FC 03 (Read Holding Registers) and FC 16 (Write Multiple Registers) for the majority of your work.

Each register is 16 bits. For 32-bit values (like floating-point numbers), two consecutive registers are used. The device manual will tell you the byte order — some devices use big-endian, others use little-endian or word-swapped formats.

7. Function Codes You Need to Know

You do not need to memorize all Modbus function codes. In day-to-day work, these six cover 95% of tasks:

CodeHexNameWhat It Does
010x01Read CoilsReads 1-bit ON/OFF values (digital outputs)
020x02Read Discrete InputsReads 1-bit input status (digital inputs)
030x03Read Holding RegistersReads 16-bit read/write registers — the most used function
040x04Read Input RegistersReads 16-bit read-only registers (measurements)
060x06Write Single RegisterWrites one 16-bit value to a holding register
160x10Write Multiple RegistersWrites multiple consecutive 16-bit holding registers

Exception Responses

If a slave cannot process a request, it responds with an exception. The function code in the response has the high bit set (original code + 0x80). For example, if FC 03 fails, the response contains FC 0x83.

Common exception codes:

CodeMeaningLikely Cause
01Illegal FunctionThe slave does not support this function code
02Illegal Data AddressThe requested register address does not exist
03Illegal Data ValueThe value you tried to write is out of range
04Slave Device FailureThe slave encountered an internal error

8. Addressing: The Zero-Based Offset Trap

This is the single biggest source of confusion in Modbus.

The Modbus data model numbers registers starting from 1 (e.g., Holding Register 40001). But the actual address sent in the Modbus PDU starts from 0.

So when a device manual says “read register 40001,” the Modbus frame sends address 0x0000. Register 40010 becomes address 0x0009.

The conversion rule:

PDU address = Register number − 1

Some SCADA software and tools handle this offset automatically. Others expect you to enter the raw PDU address. Always check which convention your software uses — if your readings are shifted by one register, this is almost certainly the cause.

💡 Pro Tip: When commissioning a new device, start by reading a known register (like a device ID register) to verify your addressing is correct before mapping hundreds of points.

9. Timing: Baud Rate, T1.5, and T3.5

Modbus RTU uses timing gaps (silent intervals) to separate messages on the bus. This is different from Modbus ASCII, which uses start/end characters.

T3.5 — Frame Delimiter

A gap of at least 3.5 character times of silence marks the boundary between messages. The master and slave both use this gap to detect the start and end of a frame.

At 9600 baud with 11-bit characters, one character takes about 1.146 ms. So T3.5 = approximately 4 ms.

T1.5 — Character Spacing

Within a single message frame, the gap between consecutive characters must not exceed 1.5 character times. If a longer gap appears mid-frame, the receiver will discard the incomplete message as a CRC error.

Practical Impact

Baud RateT1.5 (approx.)T3.5 (approx.)
96001.7 ms4.0 ms
192000.86 ms2.0 ms
384000.43 ms1.0 ms
1152000.14 ms0.33 ms

⚠️ Warning: At baud rates above 19200, the Modbus specification fixes T1.5 at 750 µs and T3.5 at 1.75 ms (rather than calculating from character time). Some devices do not follow this rule, which can cause intermittent CRC errors at higher baud rates. If you see random failures at 38400 or 115200, try dropping to 19200.

10. Troubleshooting Common Modbus RTU Issues

ProblemLikely CauseSolution
No response from any slaveWiring wrong (A/B swapped), baud rate mismatch, or wrong COM portCheck wiring. Verify serial settings match on all devices. Try swapping A and B.
Timeout errors on specific slavesSlave address mismatch or device offlineVerify slave address. Check that the device is powered and on the bus.
CRC errorsElectrical noise, missing termination, or cable too longAdd 120-ohm termination at both bus ends. Check cable shielding and grounding.
Intermittent communicationLoose connections, stub wiring, or timing issuesInspect all screw terminals. Eliminate star wiring. Try a lower baud rate.
Wrong data valuesRegister address offset (zero-based vs. one-based)Subtract 1 from the register number if your tool uses PDU addressing.
Slave returns exception 02Illegal data address — register does not existCheck device manual for the correct register map.
All readings are zeroReading the wrong register type (input vs. holding)Verify you are using the correct function code (FC 03 vs. FC 04).
Garbage data on bus idleBus floating — no biasing resistorsEnable biasing on the master or add external pull-up/pull-down resistors.
Communication works then stopsResponse timeout too short or bus overloadedIncrease timeout. Reduce poll frequency. Check for duplicate slave addresses.

Summary

Setting up Modbus RTU over RS-485 is not complicated, but it requires attention to detail. Every device on the bus must share the same serial settings. The wiring must follow daisy-chain topology with proper termination. And register addressing must account for the zero-based offset in the Modbus PDU.

Here is a quick checklist before going live:

  • Wiring: daisy-chain, shielded twisted pair, 120-ohm termination at both ends
  • Serial settings: same baud rate, parity, data bits, and stop bits on every device
  • Addresses: unique slave address (1–247) for each device
  • Registers: correct function code for the register type, correct zero-based offset
  • Timeouts: response timeout set long enough for the slowest slave to respond

Modbus RTU has been in the field for over 45 years. It works. When it does not, the problem is almost always in the wiring or configuration — not in the protocol itself.

Author: Zakaria El Intissar

I'm an automation and industrial computing engineer with 12 years of experience in power system automation, SCADA communication protocols, and electrical protection. I build tools and write guides for Modbus, DNP3, IEC 101/103/104, and IEC 61850 on ScadaProtocols.com to help engineers decode, analyze, and troubleshoot real industrial communication systems.

Leave a Reply

Your email address will not be published. Required fields are marked *