pyhys / minimalmodbus

Easy-to-use Modbus RTU and Modbus ASCII implementation for Python.
Apache License 2.0
306 stars 146 forks source link

Using CRC to correct error #99

Closed MauroDiamantino closed 1 year ago

MauroDiamantino commented 1 year ago

Hi, taking into account that CRC is an error detection and correction code, are you using it to try to correct corrupted data? or is it being used just for detecting?

j123b567 commented 1 year ago

CRC is not error correction code.

In theory, it increases hamming distance, so it is possible to correct errors (see https://stackoverflow.com/questions/3788570/is-it-possible-to-do-rudimentary-error-correction-with-crc) but these algorithms are not widely used or they are computionally/memory expensive so they are inpractical.

Feel free to experiment with it and provide a PR.

pyhys commented 1 year ago

Closing due to inactivity. Thanks @j123b567