Multiple Masters

When an engineer starts using Modbus TCP (the Ethernet version) instead of Modbus RTU (the RS-485 version), one of the first things that they notice is that Modbus TCP supports multiple masters. Over the years, this has befuddled many a system designer who needed to move data from one Modbus master to another.

In Modbus RTU, master is a master and only a master. It doesn’t act like a slave. In fact, it can’t, it’s not built that way. It sends a message to an RTU slave device and gets an answer. That’s it. And there can’t be another master. Only one set of signals can be on the RS-485 link at any one time. Either the single RTU master is transmitting or one of the RTU slave devices is transmitting. There is no other possibility.

In cases where there were two Modbus RTU masters, each on a standalone network segment where it was the one and only master on that segment, there was no standard way to move data between the two masters. The devices had to have some other communications channel where they could share data, or they could both have a second RS-485 port with one of them as a Modbus master and the other one as a slave on the second device network. Both devices could then share data from their respective networks.

Technically, that worked, but it was rarely implemented. More likely, a controller with two RS-485 ports was the master of the two different networks. Slave data from both networks ended up in its data table, and if a device on Network A needed a value from a device on Network B, the master on Network B would get it out of the data table and write it into the device on Network B. Not elegant, but it worked. Usually this happened in systems with tens if not hundreds of Modbus RTU devices.

With the introduction of Modbus TCP, everything was simplified and easier. With Modbus TCP, controllers can much more efficiently use the bandwidth on Ethernet to be the master to hundreds of Modbus TCP devices. Where RS-485 had an electrical limitation of 32 devices, Ethernet is unlimited. Operating RAM is the only practical limitation.

And with Modbus TCP there is the ability for a network designer to use multiple masters if they so choose. Device X is no longer tied to a single Modbus TCP master. One, two, or any number of masters are free to query, and yes, write to, that Modbus TCP device. If there are two controllers in a machine, both controllers can get access to the data of Device X whenever it’s needed. That creates a much more easily managed system than provided by Modbus RTU.

This works because in computer science terms, Modbus TCP is stateless, meaning the device processes a single transaction and retains no information from that transaction. That is the opposite of protocols that use states, such as EtherNet/IP or Profinet IO. These protocols make a connection and messages are processed within the context of that connection.

Since Modbus TCP uses stateless connections, it is possible for two or more masters to write to the same register or coil in a Modbus device, and even write different values. There is nothing to prevent Modbus TCP Master 1 from setting the speed of a motor to 100 rpm and a Master 2 to set it to 1000 rpm. The Modbus TCP device, which supports multiple TCP connections, happily processes both messages and sets the motor speed to the value of the last write message received.

RTA has a full line of Modbus TCP products you can use in all sorts of Modbus applications. Contact our inside sales team at 800-249-1623 and they will be glad to help you.