EM500 Open-Loop Vector Control Inverter User Manual 0x44,0x84,0x85,0x45,0x87,0x47,0x46,0x86,0x82,0x42,0x43,0x83,0x41,0x81,0x80,0x40 }; Uint16CRC(Uint8 * buffer, Uint8 crc_len) { Uint8 crc_i,crc_lsb,crc_msb; Uint16 crc; crc_msb = 0xFF; crc_lsb = 0xFF; while(crc_len--) { crc_i = crc_lsb ^ *buffer; buffer ++; crc_lsb = crc_msb ^ crc_l_tab[crc_i]; crc_msb = crc_h_tab[crc_i]; } crc = crc_msb; crc = (crc return crc; } CRC16 look-up table for 16-bit processor:
the finally returned result of this const Uint16 crc_table[256] = { program is with high byte in the front, so please reverse it while sending.) 0x0000,0xC1C0,0x81C1,0x4001,0x01C3,0xC003,0x8002,0x41C2,0x01C6,0xC006 ,0x8007,0x41C7,0x0005,0xC1C5,0x81C4,0x4004,0x01CC,0xC00C,0x800D,0x41CD ,0x000F,0xC1CF,0x81CE,0x400E,0x000A,0xC1CA,0x81CB,0x400B,0x01C9,0xC009 ,0x8008,0x41C8,0x01D8,0xC018,0x8019,0x41D9,0x001B,0xC1DB,0x81DA,0x401A ,0x001E,0xC1DE,0x81DF,0x401F,0x01DD,0xC01D,0x801C,0x41DC,0x0014,0xC1D4 ,0x81D5,0x4015,0x01D7,0xC017,0x8016,0x41D6,0x01D2,0xC012,0x8013,0x41D3 ,0x0011,0xC1D1,0x81D0,0x4010,0x01F0,0xC030,0x8031,0x41F1,0x0033,0xC1F3 401