I have run into the need to simulate multiple Modbus RTU devices while working on PLC projects.
As an example one of my customers is using from 1 to 16 Modbus RTU pressure sensors and from 1 to 8 Modbus RTU totalizers. So, for him, I might need 24 Modbus devices in my office to be able to test his PLC code.
I have come up with a simple solution to the problem. I am using a spare, cheap, single Nano-10 to emulate the behavior of all 24 devices. Oh and while I am at it, I can program the Nano-10 to create all sorts of test patterns for the sensors to verify my PLC code.
I simply wrote my own Modbus RTU code and asked the PLC to not respond to Modbus on the RS485 port.
I have attached a very simple PC6 file that shows how I emulate a single Modbus device. In this example I am emulating a Modbus connected motor speed controller. The reason I had to emulate this device is that my client didn't have a spare motor speed controller to loan me and even if he did, I didn't have the a way to power up the device. My office is not wired for 460 VAC, 60 Hz, 3-phase power!
I'll post a bit of the ladder logic to pique your interest.
If you have any questions about this sort of thing, just ask.
You are more than welcome to use and hack up this code. Have at it!
Gary D*ickinson