luizcantoni / mudbus

Automatically exported from code.google.com/p/mudbus
16 stars 17 forks source link

mubbus.cpp bugfix #5

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I noticed an error in your library. Line 137 should be MessageLength = 12;
I was getting an error when writing to coils as the response was incorrect.

Original issue reported on code.google.com by dunners...@gmail.com on 6 Apr 2015 at 4:34

GoogleCodeExporter commented 9 years ago
also line 136 should be ByteArray[5] = 6;

Original comment by dunners...@gmail.com on 6 Apr 2015 at 4:38

kasperv79 commented 5 years ago

are these corrections verified?

vhu474 commented 1 year ago

YES. Confirmed and verified to fix the issue on my Weintek HMI screen Modbus. Please merge this into main branch. ByteArray[4 to 5] corresponds to message length + 1 in bytes. On main, its 2, which is clearly wrong. The modbus message itself is 5 bytes

MessageLength is 8 on main, which i dont know how they got. The Modbus TCP/IP ADU header itself is 8 bytes, not even including the modbus message. This should be 12.

Source: https://www.prosoft-technology.com/kb/assets/intro_modbustcp.pdf

vhu474 commented 1 year ago

Also, this is the official repo that Controllino uses for their HMIs. I hope this issue gets fixed.