注意:PEC的初值*PecVal0=0
以下程序是用CVI编写的。
unsigned char CVIFUNC Hot_MakePec (unsigned char *PecVal0, unsigned char PecVal){ int i; for (i = 0; i < 8; i++) { if (((*PecVal0 ^ PecVal) & 0x80) == 0) { *PecVal0 <<= 1; } else{ *PecVal0 ^= 0x03; *PecVal0 <<= 1; *PecVal0 |= 0x01; } PecVal <<= 1; } return *PecVal0;}
发布
文章评论(0条评论)
登录后参与讨论