deathwish88 / modbus-tk

Automatically exported from code.google.com/p/modbus-tk
Other
0 stars 0 forks source link

DIAGNOSTIC function with 16-bit data #29

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
The DIAGNOSTIC function was added on Oct 12.

The implementation has a 16-bit sub-function value and a number of 8-bit data 
items.

According to the modbus application protocol document chapter 6.8 the data 
field is "Nx2 Bytes", and all the documented sub-functions have 16-bit input 
and output data. (except for sub-function 3 which concerns the ASCII protocol).

I suggest the implementation be changed to use 16-bit data items by default. 
This would make it more conforming and also easier to use.

The changes involve the default input and output formats from ">B" to ">H", and 
the default expected_length calculation to "expected_length = 
2*len(output_value)+6" to account for 2 bytes pr output_value. 

Original issue reported on code.google.com by tor.sjow...@gmail.com on 2 Feb 2012 at 7:33