monthop / pymodbus

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

Placement of CRC bytes in the message wrong #34

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
According to the Modbus specification (PI-MBUS-300 Rev. J, p. 119),
the lower byte of the CRC is transmitted first, followed by the upper
byte. The current pymodbus.utilities.computeCRC() method does not
swap the bytes of the calculated CRC, resulting in errors on the
receiving side.

Please fix computeCRC() by swapping the bytes before returning the
CRC. The following code is extracted from modbus-tk:

    msb = word_val >> 8
    lsb = word_val % 256
    return (lsb << 8) + msb

Original issue reported on code.google.com by albert.k...@gmail.com on 9 Feb 2011 at 2:29

GoogleCodeExporter commented 9 years ago
The placement of the CRC is described on page 113, not 119. It's the
119th page of the document, though :-).

Original comment by albert.k...@gmail.com on 9 Feb 2011 at 2:30

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r103.

Original comment by Bashw...@gmail.com on 9 Feb 2011 at 3:10