modbus_read_bits() & modbus_read_registers() mysteriously stop working

213 views
Skip to first unread message

paulqnz

unread,
May 13, 2015, 12:37:33 AM5/13/15
to libm...@googlegroups.com
Hi,

I have a Microsoft MFC application that is at times successfully using libmodbus to control some motors using modbus TCP. For example I use modbus_write_bit() to turn motors on or off, change direction, and use modbus_write_register() to set the speed. I also successfully use modbus_read_bits() and modbus_read_registers() to read back motor status and speed respectively. All of it behaves predictably.

However, at some as-yet-undetermined point, all of the modbus_read_XXX() calls start to fail and return -1. When I call modbus_strerror( errno ) it consistently returns "Domain error". However, the modbus_write_XXX() functions continue to behave as normal, allowing me to set motor speed, direction, turn on and off, etc. This makes no sense to me - does it make sense to anyone out there?

Any suggestions for how to diagnose what is going on and preferably fix it, or recover from it and continue, would be gratefully received.

Paul,
New Zealand.
Reply all
Reply to author
Forward
0 new messages