B
bjluoagzn
Unregistered / Unconfirmed
GUEST, unregistred user!
[h1][red]
[/red][/h1][!]
代码:
void computeCRC(IN unsigned char* pInBuffer, IN unsigned short length, OUT unsigned char *pTransmitFirst, OUT unsigned char *pTransmitSecond)
函数功能:
计算TYPEB的数据帧的CRC
参数说明:
pInBuffer 指向待处理的数据缓冲区
length 数据长度 ,不计入crc本身的2字节
pTransmitFirst 指向要首先发送的CRC字节(低字节)
pTransmitSecond 指向第二个CRC字节(高字节)
返回值:
无
备注:
void computeCRC(unsigned char* pInBuffer, unsigned short length, unsigned char *pTransmitFirst, unsigned char *pTransmitSecond)
{
unsigned char ch;
unsigned short wCrc;
unsigned short temp1,temp2,temp3,temp4;
wCrc = 0xFFFF; // ISO/IEC 13239 (formerly ISO/IEC 3309)
do {
ch = *pInBuffer++;
ch = (ch^(unsigned char)(wCrc & 0x00FF));
ch = (ch^(ch<<4));
temp1=(wCrc >> 8);
temp3=((unsigned short)ch << 8);
temp4=((unsigned short)ch<<3);
temp2=((unsigned short)ch>>4);
wCrc=temp1 ^temp2^temp3^temp4;
} while (--length);
wCrc = ~wCrc; // ISO/IEC 13239 (formerly ISO/IEC 3309)
*pTransmitFirst = (unsigned char)(wCrc & 0xFF);
*pTransmitSecond = (unsigned char)((wCrc >> 8) & 0xFF);
return;
}
//=======================================================================
//源文件结束
能否帮我把上面的C语言程序转换成Delphi.谢谢
能否帮我把上面的C语言程序转换成Delphi.谢谢
能否帮我把上面的C语言程序转换成Delphi.谢谢
能否帮我把上面的C语言程序转换成Delphi.谢谢