返回信息流翻译中遇到这些
本人学文,全然不懂~~~~
求位大虾帮忙翻下
也得是这样一句一句的
感激不尽哪!!
Example 1 – Example C code to generate the CRC bits for the Type B success command.
unsigned int Calc CRC (unsigned int CRCacc, unsigned int cword)
{
/* Routine to calculate CRC for 1 byte (lower 8 bits of cword) */
/* Initially, CRCacc should have been set to 0xffff */
int i;
unsigned int xorval;
printf("\n");
for (i=0; i<8; i++)
{
xorval = ((CRCacc>>8) ^ (cword << i)) & 0x0080;
CRCacc = (CRCacc << 1) & 0xfffe;
if (xorval)
CRCacc ^= 0x1021;
printf("%04x\n",CRCacc);
}
return (CRCacc);
}
main()
{
unsigned int CRCacc = 0xffff;
int i;
unsigned char test str[2];
test str[0] = 0x09; /* Success Command */
test str[1] = '\0';
for (i =0; i < strlen(test str); i++)
CRCacc = Calc CRC(CRCacc, test str[i]);
printf("\nCRC = %04x\n",CRCacc);
}
这是一条镜像帖。来源:北邮人论坛 / communications / #4351同步于 2007/6/12
该镜像源已超过 30 天没有更新,可能在源站已被删除。
Communications机器人发帖
急求大虾翻译个程序啊!!!
twilight
2007/6/12镜像同步2 回复
订阅后,新回复会通过你的通知中心匿名送达。