First of all, the modbus protocol, mainly divided into three kinds:
1. For the serial port: Modbus RTU, Modbus ASCHl, commonly used serial port RS232/RS422/RS485
2. For the network interface: Modbus TCP, commonly used network interface: RJ45
3. Modicon dedicated Modbus Plus
Modbus RTU and Modbus ASCI use asynchronous serial transmission, while Modbus TCP is based on the TCP/IP protocol.Modbus is a half-duplex communication, using the master-slave communication mode, there can only be a master station at the same time. So it is possible to communicate with two masters and multiple slaves as mentioned by the questioner. If we use Modbus RTU communication, we can use relays to switch between different slaves. Of course, there are other ways, Modbus Plus is a high-speed token network, the token can be quickly passed between the stations, whoever gets the token, who is the master. So it also solves the problem of multiple masters and multiple slaves. But because this is Modicon's special protocol, not open, for the open Modbus protocol still can not be realized. Generally speaking, the Modbus communication we commonly use is Modbus RTU and Modbus TCP, Modbus RTU needs to use polling method to read and write. Modbus TCP is a client-server model that allows multiple clients on the network.
Therefore, in view of the requirement of the question, the simplest way is to convert Modbus RTU protocol to Modbus TCP protocol. How to convert? Many manufacturers have corresponding protocol conversion gateway devices that can realize this function, such as the commonly used MOXA.
For example, MOXA's MB3170 can integrate ModbuSTCP, ASCI and RTU devices or even a mixed network of multiple masters and slaves, including serial masters to serial slaves, or to Ethernet masters at the same time.
This gateway allows multiple masters to access the slaves at the same time. Since we are using the TCP/P protocol, this corresponds to the mode of multiple clients accessing multiple servers at the same time.




