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.75k forks source link

Data getting mixed up #135

Closed Alphonseja closed 11 years ago

Alphonseja commented 11 years ago

We started using libmodbus library recently. We are reading data from 13 energy meters. We are using meters of two differennt companies. We have given 500 milli second delay between every requests. We are using RS - 232 to RS - 485 converter for reading data through the serial port of the computer. We are getting correct values from all the meters most of the time. But some times values are getting mixed up. That means, for example, we see Phase 12 voltage where Phase 1 voltage should be shown. Any work arounds? Please help.

celioric commented 11 years ago

Hello Alphonseja,

With 13 devices sometimes the problem could be in the network... I am also starting using libmodbus, but usually when I have this king of problem with other softwares I start with some primary checks:

Alphonseja commented 11 years ago

Hi, We are reading approximate 20 registers per request. Baud rate is 9600 bps.

Is there any way by which we could check whether the response contains invalid data using some functions in LibModbus library.

Alphonseja commented 11 years ago

Hi, Can we use the value of "errno" in LibModbus for checking invalid values in the response?

stephane commented 11 years ago

Yes of course, as stated in documentation, you must check function return codes (for example, http://libmodbus.org/site_media/html/modbus_read_registers.html)

stephane commented 11 years ago

@alphonseja my recent addition to libmodbus documentation could help you, https://github.com/stephane/libmodbus/commit/a11805cbfda23da36aed84bca3c5edc1413d664c

Please, don't hesitate to comment any typo/mistakes on it.