LogicMachine Forum
Modbus TCP Slave Problem - Printable Version

+- LogicMachine Forum (https://forum.logicmachine.net)
+-- Forum: LogicMachine eco-system (https://forum.logicmachine.net/forumdisplay.php?fid=1)
+--- Forum: Scripting (https://forum.logicmachine.net/forumdisplay.php?fid=8)
+--- Thread: Modbus TCP Slave Problem (/showthread.php?tid=6025)



Modbus TCP Slave Problem - JaegerMa2 - 17.06.2025

Hello
I want to write values to a slave. The script I have has been configured with various logs to determine where the problem lies. The log indicates that the script is running successfully, but no values are being written. When I check the traffic on port 502 with Wireshark, I don't see any traffic. However, when I poll the slave using Modbuspoll, everything works fine. I've also tried adjusting the register address because it might be offset by 1, but to no avail. Can someone tell me what I'm doing wrong?


RE: Modbus TCP Slave Problem - admin - 17.06.2025

The recommended way is to use profiles instead of scripts: https://forum.logicmachine.net/showthread.php?tid=5911

Each value for writemultipleregisters is passed as a separate argument, not a table:
Code:
mb:writemultipleregisters(32, 1)
mb:writemultipleregisters(33, 1)

You can write to both registers with one call:
Code:
mb:writeregisters(32, 1, 1)



RE: Modbus TCP Slave Problem - khalil - 15.09.2025

Hello Admin
how could we capture the communication between LM,SL and the mocbus TCP device over port 502
I also try wireshark but I cannot see any trafic seems because I am using VPN, is there a native tool build inside LM,SL ?


RE: Modbus TCP Slave Problem - admin - 15.09.2025

There's no tool for packet capture on the device itself. You can use a managed switch with port mirroring for this.


RE: Modbus TCP Slave Problem - khalil - 15.09.2025

(15.09.2025, 11:20)admin Wrote: There's no tool for packet capture on the device itself. You can use a managed switch with port mirroring for this.

could this help?
https://forum.logicmachine.net/showthread.php?mode=linear&tid=4230&pid=27310#pid27310


RE: Modbus TCP Slave Problem - admin - 15.09.2025

It can provide some debug info but not the lower-level communication. It can only be used via script and won't be useful if you use profiles.

What is the problem that you have?


RE: Modbus TCP Slave Problem - khalil - 15.09.2025

(15.09.2025, 11:27)admin Wrote: It can provide some debug info but not the lower-level communication. It can only be used via script and won't be useful if you use profiles.

What is the problem that you have?

I have VRV gateway from Midea GW-Modbus(A), but there are somme issue with commands and feedback.
some times command from SL didnt executed also feedback comes after a slight long time.
I want to trouple shoot this issue to exactly know where the isse, is it from SL or from the VRV GW.
I check the modbus error log but there are nothing.