kochedykov / jlibmodbus

JLibModbus - is an implementation of the Modbus protocol v1.1b in java language. Java modbus library. It works. Welcome.
http://kochedykov.github.io/jlibmodbus/
Apache License 2.0
299 stars 128 forks source link

ReadRegisters returns data only on second read #70

Open pfried opened 3 years ago

pfried commented 3 years ago

I do read Input / Holding registers via

int[] registerValues = this.modbusMaster.readHoldingRegisters(slaveAddress, startAddress, quantity);

But the first read will timeout saying no data received before timeout. If I run the query twice the seconds attempt succeeds. I guess the "old" data is read on the second command. This would explain it fails every time the amount of data to be received fails. Subsequent queries succeed if they have the same length, if the length changes it fails.

Data is coming in correctly and in the correct time which I verified on the Oscilloscope.

Is there any known issue? I would try changing the timeouts but due to #49 it seems I cannot do that in blocking read.

JSerialComm 2.4.0 (not able to upgrade due to #53) JLibModbus 1.2.9.7 Windows 10 64bit

Shaco74 commented 2 years ago

Having exactly the same issue.