APPLICATION NOTE
How to Integrate Modbus Data into Allen-Bradley ControlLogix and CompactLogix PLCs
Part 2 of 2
Integrating Modbus RTU/TCP into Allen-Bradley Logix platforms requires bridging two different communication worlds. Because ControlLogix and CompactLogix do not support Modbus natively, engineers must choose between custom PLC logic, PC middleware or dedicated protocol gateways. This guide covers the essential steps for data mapping, solving endianness (byte-swapping) issues and selecting the most maintainable integration architecture.
All those devices in the Modbus world generate valuable data and very often that data needs to be read by Allen-Bradley ControlLogix and CompactLogix PLCs. This article answers the most common questions for integrating Modbus data into A-B PLCs.
New to Modbus, or want a refresher on how it works? See the companion article, Why and When It Makes Sense to Integrate Modbus and Allen-Bradley ControlLogix and CompactLogix PLCs, which covers Modbus RTU and TCP basics, how Modbus data is structured (coils and registers), endianness, and why Modbus devices are worth integrating. This article picks up where that one leaves off and focuses entirely on implementation.
How Are Modbus Registers Mapped into PLC Tags?
Configuration software is required to map the registers and coils of Modbus devices into the different data types of Allen-Bradley PLC tags. Applications that require Modbus to ControlLogix or Modbus to CompactLogix rely on proper mapping of Modbus registers and coils into the data tables of these PLCs.
Seven steps for mapping Modbus register(s) and coils to PLC tags
- Use the technical documentation for the Modbus device to identify the Modbus register and coil addresses that must be integrated into a PLC control program.
- Identify the type and size of the Modbus coils and register(s). Example: two Modbus registers are sometimes used to represent a double integer.
- Identify the target data type in the PLC for each register and coil.
- Describe the conversions you will need for each register and coil:
- One register → INT
- Two registers → DINT or REAL
- Coil bit masks → BOOL tags
- Scaled integers → engineering units
- Verify the byte and word order of the Modbus device (big- or little-endian).
- Identify what byte and word swapping is required to move those coils and registers to the Allen-Bradley PLC (little-endian).
- Choose a Modbus-to-A-B PLC gateway that can accomplish the required conversions and byte and word swapping.

Typical failures when mapping Modbus registers to PLC tags
- The word or byte order (endian) used in the translation is incorrect.
- The swapping is performed incorrectly.
- The Modbus register context is incorrect (e.g., a Modbus register is actually one word of a four-word series implementing a floating-point value).
- Registers are converted to the wrong engineering unit.
What Are the Options for Moving Modbus Data into Logix PLCs?
There are three common ways to integrate Modbus data into ControlLogix and CompactLogix PLCs: PLC logic, PC-based middleware and protocol gateways. PLC logic provides maximum control but requires significant engineering effort and long-term maintenance. PC-based middleware — including writing your own application on a Windows PC to act as a gateway — simplifies protocol handling but introduces operating system and cybersecurity dependencies. Protocol gateways offer the lowest-risk and most maintainable approach by offloading communication, data conversion and error handling from the PLC.
| PLC Logic | PC Middleware | Modbus gateway | |
|---|---|---|---|
| Deployment Time | Slow | Slow | Fast |
| Ease of Configuration | Hard-coded | Easy | Easy |
| Maintainability | Low | High | High |
| Cost Profile | High Labor Cost | Low | Low |
| Overall Risk | High Risk | Low Risk | Low Risk |
| Common Use Case | Fixed application with one or two Modbus devices | Any Modbus-to-PLC application | Any Modbus-to-PLC application |
- Use PLC logic when Modbus support is minimal and engineering control is more important than long-term maintenance.
- Use PC middleware when centralized data aggregation already exists and IT ownership is clear.
- Use protocol gateways when fast deployment, system stability and long-term maintainability are priorities.
The engineering reality is that protocol gateways provide the best balance of deployment speed, reliability and long-term maintainability for most Modbus-to-Logix integrations.
How Do You Choose the Correct Modbus to PLC Gateway?
To choose the correct Modbus-to-PLC gateway, first determine whether you want the PLC to control the operation of the Modbus network (RTU master or TCP client) or to be an end node on the Modbus network (RTU slave or TCP server).
- PLC must control a Modbus RTU network: choose a Modbus RTU master gateway. It allows the controller to read and write Modbus RTU slave devices.
- PLC must control a Modbus TCP network: choose a Modbus TCP client gateway. It allows the controller to read and write Modbus TCP server devices.
- PLC must be a node on a Modbus RTU network: choose a Modbus RTU slave gateway. It allows a Modbus RTU master to read and write the PLC as if it were an RTU slave.
- PLC must be a node on a Modbus TCP network: choose a Modbus TCP server gateway. It allows a Modbus TCP client to read and write the PLC as if it were a TCP server.
What Is the Commissioning Time for a Modbus to PLC Gateway?
Once the gateway is placed on the DIN rail and wired to power and to an Ethernet switch, a Real Time Automation Modbus gateway can be operational in as little as 10 minutes once network access and device documentation are available.
- Configuration is all browser-based; no special software is needed.
- Configuration essentially maps Modbus device registers to PLC tags and identifies data format changes (e.g., unsigned integer to double).
Extended commissioning time is often the result of insufficient Modbus documentation.
Documentation for Modbus devices can be difficult to find. Identifying which Modbus registers are available, what their contents are and how they are formatted can be time-consuming and tedious. On the other hand, when documentation is available, commissioning can be very rapid, as many Modbus devices contain only a few registers of data. A scale, for example, contains gross weight, tare weight and one or two other values.
What Common Problems Occur When Integrating Modbus RTU with Allen-Bradley PLCs?
Wiring, byte ordering, data formatting and documentation are the biggest issues users face when integrating Modbus RTU devices into a programmable controller. Integration is not difficult if you have the correct documentation and understand byte ordering, scaling and data typing. Do these things to mitigate the potential for integration problems:
Have the correct documentation available
Ensure that you have the latest documentation for the specific software versions of your Modbus devices.
Understand which byte ordering (endian) your Modbus device uses
While many Modbus devices use big-endian, some do not — and Allen-Bradley PLCs use little-endian. For example, a Modbus register with a value of 258 exists in memory as byte 01 followed by byte 02. In Modbus, that is 01 × 256 + 02, or 258. In a PLC, a tag value with those bytes would be interpreted as 02 × 256 + 01, or 513.
Use a protocol gateway that can perform byte swapping automatically
A protocol gateway such as a Real Time Automation Modbus gateway can automatically perform byte swapping so that a memory value of 0102 is stored in the PLC tag memory as 0201.
Validate your Modbus device maps
If your documentation indicates that a register contains a pressure value, verify that it actually contains pressure and note any scaling your application may require. A sophisticated gateway can not only scale values properly but can also convert data formats to ones more optimal for your PLC control system.
Understand timing and polling limits when using Modbus RTU
With Modbus RTU, slave devices are polled by the Modbus gateway in sequence, and the message frequency varies with the number of nodes and the network baud rate. Ensure that your PLC control algorithm can tolerate the inability of a Modbus gateway to deliver data as quickly as a native Ethernet device.
Wire the Modbus RTU network properly
When installing a Modbus RTU network, pay particular attention to the RS-485 wiring designations. Unfortunately, these are not standard. RS-485 uses a differential pair, which most vendors label in one of these ways:
- A and B
- D+ and D−
- TX+ / TX− or RX+ / RX− for 4-wire
The more modern convention is:
- B = non-inverting = positive = D+
- A = inverting = negative = D−
Pay attention to Modbus RTU addressing issues
When configuring a Modbus gateway, ensure the device ID is not already in use by another device on the network.
Can a PLC Implement Modbus in PLC Logic — and When Should You Use a Gateway Instead?
Yes, Modbus can be implemented in Logix PLCs for programmers who prefer to do everything in a PLC. However, PLCs are designed for control logic, not for parsing protocol messages and performing data translations. Using a PLC to perform a gateway function increases PLC complexity, reduces maintainability and increases future risk. There are several good reasons to “farm out” the communication and decoding labor to a gateway:
PLCs are not designed for protocol parsing
Decoding and scaling Modbus data and swapping words and bytes are awkward and difficult to accomplish in a PLC.
A gateway is a coprocessor that offloads processing from the PLC
Gateways offload endian swapping, scaling and Modbus error processing to a coprocessor module that is much better equipped and specifically designed to handle those tasks.
Communication tasks consume memory and can interfere with scan times
PLCs have expensive and limited memory that is better used for control algorithms than for communication tasks.
Long-term support
Gateway providers provide support. Offloading communication logic from the PLC results in cleaner, easier-to-maintain PLC code.
What RTA Products Support Modbus Communication to Allen-Bradley PLCs?
Real Time Automation Modbus-to-PLC gateways move registers and coils between Modbus devices and ControlLogix and CompactLogix PLCs. Features of all gateways include:
- PLC needed only to process I/O data, not to manage protocol communicationsconfiguration
- Fast deployment in brownfield systems
- A five-year warranty
Two Modbus RTU gateways integrate Allen-Bradley PLCs with Modbus RTU network data
- 460ETCMM — connects Modbus RTU slave devices (maximum 32) to your Allen-Bradley PLC.
- 460ETCMRS — connects a Modbus RTU master to Allen-Bradley PLCs (maximum 5).
Two Modbus TCP gateways integrate Allen-Bradley PLCs with Modbus TCP network data
- 460ETCMC — connects Modbus TCP server devices (maximum 32) to your Allen-Bradley PLC.
- 460ETCMS — connects a Modbus TCP client to Allen-Bradley PLCs (maximum 5).
Note: both EtherNet/IP and Modbus TCP networks can share the same switch.
Summary
Integrating Modbus data into Allen-Bradley ControlLogix and CompactLogix PLCs is essential for leveraging legacy instruments and utility systems in industrial environments. Because Modbus RTU and Modbus TCP remain prevalent, effective integration requires a solid understanding of data structures, timing and byte ordering.
Proper mapping of Modbus registers and coils into PLC tags is the core of a successful integration. Follow the seven-step mapping process, keep accurate documentation and account for endianness. Common pitfalls — incorrect endian settings, data-format errors, wiring mistakes, and device-ID conflicts — are all avoidable with the right preparation.
Among the integration options, protocol gateways offer the best balance of deployment speed, reliability and long-term maintainability. Real Time Automation focuses on fast, reliable Modbus integration, offers a full line of Modbus RTU and Modbus TCP gateways, and provides excellent pre-sales and post-sales support from our team of Enginerds.
About the Author
John S. Rinaldi
Real Time Automation, Inc.
John Rinaldi is Chief Strategist and Director of WOW! for Real Time Automation (RTA) in Pewaukee WI. With a focus on simplicity, support, expert consulting and tailoring for specific customer applications, RTA is meeting customer needs in applications worldwide. John is not only a recognized expert in industrial networks and an automation strategist but a speaker, blogger, the author of more than 100 articles on industrial networking and six books including Industrial Ethernet, OPC UA: The Basics, Modbus, OPC UA – The Everyman’s Guide and ETHERNET/IP.
