As I started working with the easymodbus library for python3 I encountered an error, which occured to me while using the "write_multiple_registers" method.
My master was controlling a slave, which took its instructions from the ascii-values the master submitted into a number of registers, starting from register 0.
As my slave did not seem to respond to my masters commands, I checked the Modbus TCP/IP - message via Wireshark and found that the length of my package was wrong, as you can see in this picture:
To adjust my messages length parameter, I changed a few lines in the methods code:
line 741:
length = len(values)*2+7
instead of length = 6
line 791:
length_lsb = length&0xFF;
instead of length_lsb = 0x06;
line 792:
length_msb = (length&0xFF00) >> 8
instead of length_msb = 0x00
As you can see in my second picture, it fixed the issue for me.
Nonetheless I would love to see your take on this problem.
As I started working with the easymodbus library for python3 I encountered an error, which occured to me while using the "write_multiple_registers" method.
My master was controlling a slave, which took its instructions from the ascii-values the master submitted into a number of registers, starting from register 0.
As my slave did not seem to respond to my masters commands, I checked the Modbus TCP/IP - message via Wireshark and found that the length of my package was wrong, as you can see in this picture:
To adjust my messages length parameter, I changed a few lines in the methods code: line 741: length = len(values)*2+7 instead of length = 6
line 791: length_lsb = length&0xFF; instead of length_lsb = 0x06;
line 792: length_msb = (length&0xFF00) >> 8 instead of length_msb = 0x00
As you can see in my second picture, it fixed the issue for me. Nonetheless I would love to see your take on this problem.
Kind regards, Alex