Hello everybody,
Im trying to calculate the CRC checksum of a frame with 19 bytes:
A8 01 08 2E E8 2E D0 2E F0 2E E0 2E E0 2E E0 2E E0 2E E0
with the polynom 0x1021 and CCITT XMODEM. As result I expect 0x57B4.
However when I try to use the VCU2 library I never get this result. I already tried all combinations of odd/even and reflected, still no success...
Does somebofy know whats wrong with my code?
Thank you very much!
const uint8_t testSUMD[] =
{
0xA8,
0x01,
0x08,
0x2E, 0xE8,
0x2E, 0xD0,
0x2E, 0xF0,
0x2E, 0xe0,
0x2E, 0xE0,
0x2E, 0xE0,
0x2E, 0xE0,
0x2E, 0xE0
};
CRC_Obj CRC;
CRC_Handle handleCRC;
handleCRC = &CRC;
CRC.seedValue = 0;
CRC.nMsgBytes = 19;
CRC.parity = CRC_parity_odd;
CRC.crcResult = 0;
CRC.pMsgBuffer = (uint16_t *) &testSUMD[0];
CRC.pCrcTable = NULL;
CRC.init = (void (*)(void *))CRC_init16Bit;
CRC.run = (void (*)(void *))CRC_run16BitPoly2;
CRC.init(handleCRC);
CRC.run(handleCRC);
int crc = CRC.crcResult;