void CRC16(BYTE *Array, BYTE *Rcvbuf,unsigned int Len)
{
unsigned int IX,IY,CRC;
CRC=0xFFFF;//set all 1
if (Len<=0)
CRC = 0;
else
{
Len--;
for (IX=0;IX<=Len;IX++)
{
CRC=CRC^(unsigned int)(Array[IX]);
for(IY=0;IY<=7;IY++)
if ((CRC&1)!=0
CRC=(CRC>>1)^0xA001; else
CRC=CRC>>1; //
}
}
Rcvbuf[0] = (CRC & 0xff00)>>8;//高位置
Rcvbuf[1] = (CRC & 0x00ff); //低位置
}