void CRC16(unsigned int *buf,unsigned int bufLength)
{
unsigned int i,j,lastBit,CRC;
CRC = 0XFFFF;
for(i=0;i
{
CRC = buf[i]^CRC;
for (j=0;j<8;j++)
{
lastBit = CRC&0X0001;
CRC = CRC>>1;
if (lastBit)
CRC = CRC^0XA001;
}
}
uint crctemp = CRC;
for (i=0;i
{
Serial.write(buf[i]);
delayMicroseconds(1);
}
Serial.write(crctemp>>8);
delayMicroseconds(1);
Serial.write(CRC);
//return CRC;
}