MODBUS RTU CRC16 calculation
问题 I'm coding a MODBUS CRC16 calculator in C. What I have before is a python that do this, I wanted to convert it to C. I found some codes online but it's not giving me the correct answer. For my python code, I have this as my CRC16.py #!/usr/bin/env python def calc(data): crc_table=[0x0000,0xC0C1,0xC181,0x0140,0xC301,0x03C0,0x0280,0xC241,0xC601,0x06C0,0x0780,0xC741,0x0500,0xC5C1,0xC481,0x0440,0xCC01,0x0CC0,0x0D80,0xCD41,0x0F00,0xCFC1,0xCE81,0x0E40,0x0A00,0xCAC1,0xCB81,0x0B40,0xC901,0x09C0