hit counter script

AEG ARE H9 HF User Manual page 34

Rfid pocket reader
Table of Contents

Advertisement

Example in ANSI C:
The CRC checksum in this software example is implemented as a reverse CRC-
CCITT:
// *********************************************************************
// Function to calculate the CRC from a protocol buffer with
// the given length
// *********************************************************************
unsigned int build_crc(unsigned char length, unsigned char* protocol)
{
// the initial CRC value
#define CRC_PRESET
// the reverse CRC-CCIT pollynomial
#define CRC_POLYNOM
unsigned char i,k;
unsigned int crc;
unsigned char crc_in;
crc CRC_PRESET;
for(i=0;i< length;i++)
{
crc_in = protocol[i];
for (k=0;k<=7;k++)
{
}
}
return(crc);
}
The check sum is always composed out of 4 hex characters (values from 0x0000
to 0x FFFF). These 4 hex characters are transmitted in ASCII code from '0' ..
'9' and 'A' to 'F' .
Example: The check sum 0E2A is transmitted as CHR(0x30), CHR(0x45),
CHR(0x32), CHR(0x41).
---------------------------------------------------------------34/51---------------------------------------
0x0000
0x8408
// initial value
// loop trough the protocol
// get next protocol byte
// loop trough one byte LSB to MSB
// test each Bit for CRC calculation
if((((crc_in>>k)&0x01)^(crc&0x0001))==1)
{ crc=crc>>1; crc=crc^0x8408; }
else
{ crc=crc>>1;}

Advertisement

Table of Contents
loading

Table of Contents