S
silaszhe
Unregistered / Unconfirmed
GUEST, unregistred user!
CRC校验WORD C_Protocol::calcCRC(char *pTempBuf, int usTempLength){ unsigned int reg16; unsigned char regHi, regLow; unsigned char charCheck, charOut; int i, j; reg16 = 0xFFFF; for (i=0; i<usTempLength; i++) { regHi = (reg16 >> 8) & 0x00FF; regLow = reg16 & 0x00FF; charCheck = pTempBuf; reg16 = regHi ^ charCheck; for (j=0; j<8; j++) { charOut = reg16 & 0x0001; reg16 = reg16 >> 1; if (0x0001 == charOut) { reg16 = reg16 ^ 0xA001; } } } return reg16;}