Modbus Protocol Explained: RTU vs TCP, How It Works and When to Use Each

Share:

Instrumentation · Communication Protocols · Modbus

Modbus Protocol Explained: RTU vs TCP, How It Works and When to Use Each

A clear, practical guide to Modbus: what it is, how master-slave communication works, what registers and function codes are, and the key differences between Modbus RTU and Modbus TCP with a selection guide.

RTU vs TCP Comparison Registers and Function Codes Troubleshooting Table

If you work in industrial automation, instrumentation or process control, you will encounter Modbus every single day. It is the most widely installed industrial communication protocol in the world, running on tens of millions of devices across factories, power plants, oil and gas facilities, water treatment plants and buildings. Pressure transmitters, flow meters, variable speed drives, energy meters, gas analysers, PLCs and SCADA systems all speak Modbus.

Despite being over 45 years old, Modbus remains the universal fallback protocol in industrial automation. When two devices from different manufacturers need to exchange data and no other protocol is available, both almost certainly support Modbus. Understanding how it works is one of the most valuable skills an instrumentation or automation engineer can have.

This guide explains the Modbus protocol from the beginning: what it is, how master-slave communication works, what the four register types are, what function codes do, and most importantly, the real differences between Modbus RTU (serial) and Modbus TCP (Ethernet) and when to use each one.

What this article covers
What Modbus is and why it is still the standard  ·  Master-slave communication explained simply  ·  The four Modbus register types  ·  Most important function codes  ·  How Modbus RTU works (RS485 serial)  ·  How Modbus TCP works (Ethernet)  ·  Key differences and when to use each  ·  Common Modbus problems and how to fix them.
Advertisement
Advertisement

What Is the Modbus Protocol?

Modbus is an open, royalty-free serial communication protocol originally developed by Modicon (now part of Schneider Electric) in 1979. It was created to allow programmable logic controllers to communicate with each other and with other devices in an industrial network.

The core idea behind Modbus is simple. One device (the master) asks for data. Another device (the slave) responds with the data. That is all Modbus does. The master always initiates communication. The slave only responds when asked. This simple request-response model is the foundation of everything Modbus does.

Why Modbus has survived for 45 years
  • Open and free: No licensing fee, no royalty. Any manufacturer can implement it in their device at zero cost.
  • Simple: Very few rules to learn. A technician can understand Modbus in a day.
  • Interoperable: Devices from Siemens, Schneider, ABB, Yokogawa, Emerson and hundreds of other manufacturers all speak the same Modbus language.
  • Robust: Proven in harsh industrial environments over four decades.
  • Universal fallback: When no other protocol matches, both devices almost certainly support Modbus.

Modbus variants in common use

VariantPhysical layerMost common use
Modbus RTURS485 or RS232 serial cableField instruments to PLC/DCS over twisted-pair cable. Most common in process plants.
Modbus TCPEthernet (Cat5/Cat6)PLC to SCADA, device to device over plant Ethernet network. Fast and scalable.
Modbus ASCIIRS232 serialOlder systems. Same as RTU but data encoded as readable ASCII text. Rarely used today.
Modbus RTU over TCPEthernetRTU frame wrapped in TCP/IP packet. Used for gateways bridging serial devices to Ethernet.

Watch: How Modbus Protocol Works (Video)

This clear video from Teltonika explains how Modbus TCP/IP and Modbus RTU work in industrial IoT and M2M communication:

How Does Modbus Protocol Work? RTU and TCP Explained

How Modbus Works: Master-Slave Communication

Every Modbus network has one master and one or more slaves. This is the fundamental rule of Modbus. The master controls all communication. Slaves never transmit data on their own. They only respond to requests from the master.

When a Modbus master wants to read data from a device, it sends a request message containing three key pieces of information:

  • Slave address: Which device should respond (1 to 247 for RTU)
  • Function code: What action to perform (read, write, etc.)
  • Register address and quantity: Which data to read and how many registers

The addressed slave reads the function code, performs the action, and sends back a response containing the requested data. All other slaves on the network ignore the message because their address did not match.

Modbus is poll-based, not event-driven
In Modbus, slaves never send data on their own. They only respond when the master asks. If you want to read 10 sensors every second, your master must send 10 separate requests every second and wait for each response. This is called polling. It works reliably but means Modbus is not suitable for applications requiring very fast or simultaneous updates from many devices.

The Four Modbus Register Types

Modbus organises data in a device into four types of memory areas called registers and coils. Understanding these four types is essential for reading and writing Modbus data correctly.

Register typeData sizeRead/WriteAddress rangeWhat it holdsExample
Coils (Discrete Outputs)1 bit (ON/OFF)Read and Write0xxxx (00001-09999)Digital output states. Can be turned ON or OFF by the master.Relay output, pump start/stop command
Discrete Inputs1 bit (ON/OFF)Read only1xxxx (10001-19999)Digital input states. The master can read them but not change them.Limit switch status, alarm input, pushbutton state
Input Registers16 bits (word)Read only3xxxx (30001-39999)Analogue input measurement values. Read only by the master.Process temperature, pressure, flow measurement value
Holding Registers16 bits (word)Read and Write4xxxx (40001-49999)The most commonly used register type. Stores configuration and setpoints that the master can both read and change.Setpoint, scaling parameters, configuration settings, analogue output value
The most used register type: Holding Registers (4xxxx)
In practice, the vast majority of Modbus devices store almost all their data in Holding Registers. A typical pressure transmitter will store its current pressure reading, range settings, alarm setpoints and diagnostic data all in Holding Registers. When you read a Modbus device with a SCADA system or PLC, you will almost always be reading Holding Registers using Function Code 03.

Modbus Function Codes: What They Do

A function code tells the slave what action to perform. Every Modbus request contains one function code. The most commonly used function codes are:

Function codeNameWhat it doesUsed for
01Read CoilsReads the ON/OFF status of one or more coils (digital outputs)Reading relay states, digital output status
02Read Discrete InputsReads the ON/OFF status of one or more discrete inputsReading switch status, alarm inputs
03Read Holding RegistersReads the value of one or more holding registers (16-bit words)Most common. Reading process values, configuration, setpoints
04Read Input RegistersReads the value of one or more input registers (read-only analogue values)Reading analogue measurement values from field instruments
05Write Single CoilForces a single coil ON (0xFF00) or OFF (0x0000)Turning a relay or digital output ON or OFF
06Write Single RegisterWrites a value to a single holding registerSetting a setpoint, writing a configuration value
16Write Multiple RegistersWrites values to a block of consecutive holding registersSending multiple setpoints or configuration values in one transaction
The most important function code to know
Function Code 03 (Read Holding Registers) is by far the most used Modbus command in industrial applications. When your SCADA system polls a pressure transmitter, energy meter or VSD drive for its process value, it almost certainly uses FC03. If you can troubleshoot FC03 communication, you can troubleshoot 80% of Modbus issues in the field.
Advertisement
Advertisement

Modbus RTU: How It Works

Modbus RTU (Remote Terminal Unit) is the serial version of Modbus. It sends binary data over a twisted-pair cable using the RS485 electrical standard. Modbus RTU was the original form of Modbus and remains the most widely installed version in process plants today.

The RS485 physical layer

Most Modbus RTU networks use RS485 as the physical layer. RS485 is a differential signalling standard that uses two wires (A and B, also labelled + and -) to carry the signal. The differential nature makes it very resistant to electrical noise, which is why it works well in industrial environments near motors, drives and transformers.

Key RS485 characteristics:

  • Maximum cable length: up to 1,200 metres (4,000 feet) at low baud rates
  • Maximum devices on one bus: 247 (with addresses 1 to 247)
  • Topology: Daisy-chain (linear bus). NOT a star topology.
  • Termination resistors: 120 ohm resistors required at BOTH ends of the cable
  • Common baud rates: 9600, 19200, 38400, 57600, 115200 bps
Critical Modbus RTU wiring rules
  • Use daisy-chain topology only. Never use a star topology (branching off to multiple directions). Star wiring causes signal reflections that corrupt Modbus messages.
  • Terminate both ends. Install a 120 ohm resistor across the A and B terminals at BOTH ends of the RS485 cable. Missing termination causes communication errors.
  • All devices must use identical communication settings. Baud rate, parity, stop bits and data bits must match on every device on the bus. A single mismatch will prevent all communication.
  • Maximum 32 devices without a repeater on a standard RS485 bus. Use a repeater or signal booster if you need more than 32 devices or cables over 300 metres.

Modbus TCP: How It Works

Modbus TCP takes the same Modbus message structure and wraps it inside a standard TCP/IP Ethernet packet. Instead of sending the binary message over a two-wire serial cable, it sends it over a Cat5 or Cat6 Ethernet network using the same IP infrastructure your office network uses. Modbus TCP communicates on TCP port 502 by default.

The key change from RTU to TCP is the addition of the MBAP header (Modbus Application Protocol header) at the beginning of the message, which replaces the slave address byte and CRC of the RTU frame. The CRC is no longer needed because TCP/IP handles error detection at the network layer.

Modbus TCP in one sentence
Modbus TCP is exactly the same as Modbus RTU except the message travels inside a TCP/IP packet over Ethernet instead of a serial cable, and the CRC is removed because TCP handles error checking.

Modbus RTU vs Modbus TCP: Full Comparison

Modbus RTU

  • Serial communication over RS485 or RS232
  • Two-wire twisted pair cable, daisy-chain topology
  • One master, up to 247 slaves per bus
  • One conversation at a time on the bus
  • CRC error checking in every frame
  • Baud rates: 9600 to 115200 bps (slow)
  • Cable up to 1,200 metres at low baud rates
  • Low cost, simple wiring
  • No built-in security
  • Ideal for: field instruments, remote I/O, older devices

Modbus TCP

  • Ethernet communication over TCP/IP
  • Cat5/Cat6 cable, star topology via switches
  • Multiple clients (masters) and multiple servers (slaves)
  • Multiple simultaneous connections possible
  • TCP/IP handles error detection (no CRC)
  • Speed: 10/100/1000 Mbps (much faster)
  • Standard IP networking infrastructure
  • Higher cost per connection point
  • Requires network security (firewall, VPN)
  • Ideal for: PLC to SCADA, device to cloud, modern systems
CriteriaModbus RTUModbus TCP
Physical mediumRS485 / RS232 serial cableEthernet Cat5/Cat6
TopologyDaisy-chain only (linear bus)Star, tree, ring (via Ethernet switches)
Speed9,600 to 115,200 bps10 Mbps to 1 Gbps
Max devices per network247 per RS485 busLimited only by IP network capacity
AddressingDevice address 1 to 247IP address (192.168.x.x) plus Unit ID
Error detectionCRC in every frameTCP/IP checksum (no application-level CRC)
Simultaneous connectionsOne conversation at a timeMultiple simultaneous clients supported
Default portNot applicable (serial)TCP port 502
Cable distanceUp to 1,200 m per segment100 m per segment (extended via switches)
SecurityNone built inNone built in (use VPN and firewall)
CostLow (simple serial cable)Higher (Ethernet switch and cabling)
Best forField instruments, remote I/O, legacy devicesSCADA integration, modern PLCs, cloud connectivity

When to Use Modbus RTU vs Modbus TCP

Your situationUse Modbus RTUUse Modbus TCP
Device typeOlder field instruments, energy meters, analysers, drives with RS485 port onlyModern PLCs, SCADA systems, smart meters with Ethernet port
Communication distanceUnder 1,200 metres, no network infrastructureLong distance over existing plant Ethernet, or remote access over internet
Number of devicesSmall network (under 32 devices per bus)Large number of devices across multiple locations
Speed requirementSlow process variables that update every few secondsFast data acquisition, historian integration, real-time dashboards
System architectureStandalone field bus with no IT infrastructureConnected to plant Ethernet, MES, cloud or corporate network
BudgetLowest cost. Serial cable is cheap.Higher cost but uses existing Ethernet infrastructure
Existing installationExisting RS485 wiring already in placeNew installation or plant with existing Ethernet infrastructure
Modbus RTU to TCP gateway: the best of both
Many plants have older field instruments with RS485 Modbus RTU ports but want to integrate them into a modern Ethernet-based SCADA or cloud system. A Modbus RTU-to-TCP gateway solves this cleanly. The gateway connects to the RS485 bus on one side and to the Ethernet network on the other. The SCADA system sends Modbus TCP requests to the gateway, which converts them to RTU requests on the serial bus, collects the responses and sends them back as Modbus TCP. This allows modern systems to communicate with legacy instruments without replacing them.

Common Modbus Problems and How to Fix Them

ProblemLikely causeFix
No response from slave (RTU)Wrong baud rate or parity. Wrong slave address. Missing termination resistor. Star topology used.Verify all communication parameters match on master and slave. Check slave address configured on the device. Add 120 ohm termination at both ends of the cable. Convert to daisy-chain topology.
Intermittent communication errors (RTU)Electrical noise from nearby motors or VFDs. Missing cable shielding. Too many stubs on the bus. Marginal cable length.Check cable shield grounding (one end only). Add ferrite beads on cable near noise sources. Reduce stub lengths to under 1 metre. Add a signal repeater if bus is near maximum length.
Wrong data values readWrong register address. Wrong data type interpretation (signed vs unsigned, byte order). Wrong function code used.Check the device manual for the exact register map. Verify whether the register uses a 16-bit or 32-bit value. Check byte order (big-endian vs little-endian). Confirm function code matches the register type.
Modbus TCP: no connection (TCP)Wrong IP address. Port 502 blocked by firewall. Device not on same subnet. Device not in Modbus TCP server mode.Ping the device IP address first. Check firewall rules for port 502. Verify subnet mask. Check device configuration for Modbus TCP server enable setting.
CRC error on every message (RTU)Baud rate mismatch. Electrical noise. Cable too long. Wrong parity or stop bits setting.Verify baud rate and parity match exactly. Reduce baud rate. Check cable for damage, proper shielding and correct termination. Verify all devices share the same communication settings.
Only some slaves respondDuplicate slave addresses on the bus. Faulty device on the bus causing signal corruption. Bus length exceeded.Verify each slave has a unique address. Disconnect devices one at a time to identify a faulty device causing collisions. Add a repeater if bus exceeds maximum recommended length.
Advertisement
Advertisement

Further Reading and External Resources

High authority external resources on Modbus protocol

Frequently Asked Questions: Modbus Protocol

What does Modbus stand for?
Modbus is short for Modicon Bus. It was developed by Modicon (now part of Schneider Electric) in 1979 as a communication protocol for their programmable logic controllers. The name refers to the company and the bus network it was designed for.
What is the difference between Modbus RTU and Modbus TCP?
Modbus RTU sends data over a serial RS485 cable using binary encoding with a CRC error check. Modbus TCP sends the same data over an Ethernet network wrapped inside a TCP/IP packet. The function codes and register structure are identical. Only the transport medium and frame format differ.
What port does Modbus TCP use?
Modbus TCP uses TCP port 502 by default. This is the officially registered standard port. Some devices allow configuration of an alternative port, but port 502 must be open on any firewall between the Modbus master and slave for communication to work.
How many devices can connect on a Modbus RTU network?
The Modbus specification allows up to 247 slave devices (addresses 1 to 247) on a single Modbus RTU network. In practice, a standard RS485 driver supports up to 32 devices without a repeater. Use RS485 repeaters or signal boosters to extend beyond 32 devices.
What is the most commonly used Modbus function code?
Function Code 03 (Read Holding Registers) is by far the most used. It reads one or more 16-bit holding registers from a slave device. Most process values, setpoints and configuration data in SCADA and PLC applications are read using FC03.
Is Modbus secure?
No. Standard Modbus has no built-in security. There is no encryption, no authentication and no access control. Any device on the network can read or write to any Modbus slave. For Modbus TCP networks connected to corporate networks or the internet, use firewalls, VPNs and network segmentation to protect Modbus devices from unauthorised access.

What we learn today

  • Modbus is the most widely used industrial communication protocol in the world. It is open, free, simple and works across virtually every manufacturer's equipment.
  • Modbus uses a master-slave model. The master always initiates requests. Slaves only respond when addressed. Only one conversation at a time on an RTU bus.
  • There are four Modbus register types: Coils (digital output, read/write), Discrete Inputs (digital input, read only), Input Registers (analogue input, read only) and Holding Registers (read/write, most commonly used).
  • Function Code 03 (Read Holding Registers) is the most used Modbus command. Master your understanding of FC03 and you understand 80% of Modbus communication.
  • Modbus RTU sends binary data over RS485 serial cable. It is inexpensive, reliable and ideal for field instruments. Key rules: daisy-chain topology, 120 ohm termination at both ends, all devices must share identical baud rate and parity settings.
  • Modbus TCP wraps the same Modbus message in a TCP/IP packet over Ethernet. It is faster, supports star topology, allows multiple simultaneous connections and uses TCP port 502.
  • The function codes and register structure are identical in RTU and TCP. Only the transport layer and frame format differ.
  • Modbus has no built-in security. Protect Modbus TCP networks with firewalls, VPNs and network segmentation, especially when connected to corporate networks or the internet.
  • A Modbus RTU-to-TCP gateway lets you integrate legacy RS485 instruments into modern Ethernet-based SCADA and cloud systems without replacing the field devices.

Leave a Reply

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