?? crc.c
字號:
#define CRC_POLY 0x25
//unsigned int CRC_POLY 0x9240;
union WordUnion
{
struct
{
unsigned char lowbyte;
unsigned char highbyte;
}twobyte;
unsigned int word;
};
main()
{
union WordUnion TempWord;
unsigned char i,lowbyte,highbyte;
highbyte=0x70;
lowbyte=0x00;
TempWord.twobyte.lowbyte =lowbyte;
TempWord.twobyte.highbyte =highbyte;
for ( i=0 ; i<16; i++)
{
if (TempWord.twobyte.highbyte & 0x80)
{
//TempWord.word <<= 1;
TempWord.twobyte.highbyte <<= 1;
if(TempWord.twobyte.lowbyte & 0x80)
{
TempWord.twobyte.highbyte|=0x01;
}
TempWord.twobyte.lowbyte<<=1;
TempWord.twobyte.highbyte ^= CRC_POLY;
}
else
{
TempWord.twobyte.highbyte <<= 1;
if(TempWord.twobyte.lowbyte & 0x80)
{
TempWord.twobyte.highbyte|=0x01;
}
TempWord.twobyte.lowbyte<<=1;
}
}
TempWord.twobyte.highbyte=TempWord.twobyte.highbyte;
i=TempWord.twobyte.highbyte;
i=TempWord.twobyte.lowbyte;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -