SciFiDryer / ModbusMechanic

Cross platform GUI MODBUS TCP/RTU simulator & gateway. Interprets data types including ascii float and int.
Apache License 2.0
158 stars 14 forks source link

RTU Slave Simulator doesn't update watch window #15

Closed stif closed 1 year ago

stif commented 1 year ago

First of all: Thank you very much for sharing this useful software! It helps a lot developing some Modbus Master and Slave Devices (ESP32+Max487 Hardware with eModbus Library as Master and Attiny85+Max487 as Slave with tinnymodbus Software). I mainly use Modbus RTU on a Linux Machine and it is a great tool to analyze and test modbus traffic.

I just wanted to know if the Modbus Slave Simulation should work with RTU too? (i have tested it successfully with Modbus TCP when running as root). eg. i have a Modbus RTU Master which regularly polls some registers and i want ModbusMechanic to answer to this polls. (aka act as a virtual Sensor) Dont know if this is not Implemented, a bug or a User Error from my side :)

Also when i open the Serial Monitor, i do not see any Traffic, and cannot send Packets any more ("cannot open serial port ttyUSB0") until i close the Serial Monitor Window again..

$java -version                                                                                                                                                                                                ✔ 
openjdk version "11.0.18" 2023-01-17
OpenJDK Runtime Environment (build 11.0.18+10)
OpenJDK 64-Bit Server VM (build 11.0.18+10, mixed mode)
$
$uname -r                                                                                                                                                                                                     ✔ 
5.15.89-1-MANJARO

Anyways i am very happy with the core feature of this tool!

Cheers, Stefan

SciFiDryer commented 1 year ago

Yes, the slave simulator should work for RTU as well as TCP. Are you able to use the RTU master function to communicate with slaves on the same serial port?

RTU master, RTU slave, and RTU monitor all require an exclusive lock on the serial port. Given this limitation, ModbusMechanic can only support one of these functions at a time per a serial port.

SciFiDryer commented 1 year ago

I was not able to reproduce any problems with the RTU slave or RTU monitor functions. I did find a bug where the watch window will not print updates when running in RTU slave mode. This is now fixed in c9a8aa7.

Other possible causes for RTU not working often are:

If you start ModbusMechanic with the -debug argument, it will print out all data received on the serial line. If there is a bug I have missed, please comment on this issue. If not I will close in a few days.