stephane / libmodbus

A Modbus library for Linux, Mac OS, FreeBSD and Windows
http://libmodbus.org
GNU Lesser General Public License v2.1
3.44k stars 1.74k forks source link

modbus_write_registers Does not support more than 10 registers #716

Closed luocheng610 closed 1 year ago

luocheng610 commented 1 year ago

modbus_write_registers Does not support more than 10 registers?

If you write multiple registers continuously, but if more than 10 registers are written, -1 will be returned. I have tested it repeatedly. Because I have never used so many registers before, I didn't find any problems. Have you ever encountered this?

luocheng610 commented 1 year ago

I found that there may be a problem with the 【_modbus_receive_msg】 interface, because in RTU mode, it should normally return 8, but the actual return is 5, causing the function code of subscript 1 to be 144.

luocheng610 commented 1 year ago

I get it, I'm an idiot. [modbus slave] I forgot to set the quantity for this tool.