기술자료/USN

RFID ISO 15693 16Bit CRC

와이즈캣 2012. 9. 27. 14:42
728x90
반응형

unsigned short Emb_Crc(void *arg)
{
  unsigned short i;
  unsigned short j;
  unsigned short cnt;
  unsigned short crc=0xFFFF;
  unsigned short temp;
  unsigned char *buf = arg;

  cnt = (*buf) - 2;

  for(i=0 ; i < cnt ; ++i)
  {
    crc^= *(buf + i);
    for(j=0 ; j < 8 ; ++j)
    {
      if(0 != (crc&0x0001))
      {
        crc=(crc>>1)^0x8408;
      }
      else
      {
        crc=(crc>>1);
      }
    }
  }

  return crc;
}


728x90