Betriebsanleitung
Lasermesssystem LD OEM
Function:
block_crc16_word
Abstract:
calculates CRC16 signature of a block of data words (16bit)
Version:
1
--------------------------------------------------------------------------
Return value:
type
functional description
WORD
CRC signature
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Importlist:
type
identifier
WORD*
data
WORD
numofbytes
WORD
initial_crc
WORD[]
crctab
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Exportlist:
type
identifier
none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
PUBLIC WORD block_crc16_word
(
WORD*
data,
WORD
numofbytes,
WORD
initial_crc
)
{
register WORD d;
register WORD crc = initial_crc;
numofbytes >>= 1;
while( numofbytes-- )
{
d = *data++;
crc = ( (crc << 8) | ((BYTE)( d >> 8 ) ) ) ^ crctab[crc>>8];
crc = ( (crc << 8) | ((BYTE)
}
return crc;
}
/*
--------------------------------------------------------------------------
Function:
crc16_byte
Abstract:
calculates CRC16 signature of a single data byte
8 010 327/0000/28-09-2004
Anhang
functional description
pointer to data block
number of bytes (not words!) in data block
initial CRC value
CRC XOR table (as global variable)
functional description
d
© SICK AG · Division Auto Ident · Germany · All rights reserved
))
^ crctab[crc>>8];
Kapitel 10
10-15