This video will describe code to generate Modbus CRC checks for data over RS485 links. Cyclic Redundancy Check is an industry standard for error detection.
Scamp2e
https://www.tindie.com/products/johnc...
https://udamonic.com/what-is-a-scamp....