viganabd / nmodbus

Automatically exported from code.google.com/p/nmodbus
0 stars 0 forks source link

Implementation does not follow Modbus data model addressing #66

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.ReadHoldingRegisters(1, 1, 1);

What is the expected output? What do you see instead?
The PDU should contain 0x00, 0x00 for the starting address.  Instead, the PDU 
contains 0x00, 0x01.

What version of the product are you using? On what operating system?
Version 1.11.0

Please provide any additional information below.

Here is an excerpt from the Modbus Application Protocol:
"The MODBUS application protocol defines precisely PDU addressing rules.
In a MODBUS PDU each data is addressed from 0 to 65535.
It also defines clearly a MODBUS data model composed of 4 blocks that comprises 
several elements numbered from 1 to n.
In the MODBUS data Model each element within a data block is numbered from 1 to 
n."

And again:
"The previous figure shows that a MODBUS data numbered X is addressed in the 
MODBUS PDU X-1."

So as you can see, the address transmitted in the PDU should be 1 less than the 
address passed to the methods.

Original issue reported on code.google.com by james.gr...@gmail.com on 16 May 2013 at 8:44

GoogleCodeExporter commented 8 years ago
At the least, it would be nice to have a property that could be set to enable 
the address decrement, so as not to create a breaking change and to support 
applications that do and do not expect the address to be decremented.

Original comment by james.gr...@gmail.com on 16 May 2013 at 8:48