Kapitel 10
0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,
0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0
};
//========================================================================
// global scope function definitions (type modifier: PUBLIC)
/*
--------------------------------------------------------------------------
Function:
block_crc16_byte
Abstract:
calculates CRC16 signature of a block of bytes
Version:
1
--------------------------------------------------------------------------
Return value:
type
functional description
WORD
CRC signature
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Importlist:
type
identifier
BYTE*
data
WORD
numofbytes
WORD
initial_crc
WORD[]
crctab
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Exportlist:
type
identifier
none
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
*/
PUBLIC WORD block_crc16_byte
(
BYTE*
data,
WORD
numofbytes,
WORD
initial_crc
)
{
WORD crc = initial_crc;
while( numofbytes-- )
crc = ( (crc << 8) | *data++ ) ^ crctab[crc>>8];
return crc;
}
/*
--------------------------------------------------------------------------
10-14
Anhang
functional description
pointer to data block
number of bytes in data block
initial CRC value
CRC XOR table (as global variable)
functional description
© SICK AG · Division Auto Ident · Germany · All rights reserved
Betriebsanleitung
Lasermesssystem LD OEM
8 010 327/0000/28-09-2004