This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Modbus TCP Slave Problem
#1
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?

Attached Files Thumbnail(s)
   
.txt   TCP_Slave.txt (Size: 3.52 KB / Downloads: 2)
Reply
#2
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)
Reply


Forum Jump: