Newland NLS-FM30 Series User Manual page 24

Fixed mount barcode scanner
Hide thumbs Also See for NLS-FM30 Series:
Table of Contents

Advertisement

Types : 0x07
Lens
: 0x01
Address: 0x0000~0x00FF, starting register address.
Datas : 0x00~0xFF, number of registers to be read. When Datas=0x00, 256 contiguous
registers are to be read.
FCS
: CRC-CCITT checksum, 2 bytes.
Computation sequence: Types+ Lens+Address+Datas;
polynomial: X
The following C language program is provided for reference.
unsigned int crc_cal_by_bit(unsigned char* ptr, unsigned int len)
{
unsigned int crc = 0;
while(len-- != 0)
{
for(unsigned char i = 0x80; i != 0; i /= 2)
{
crc *= 2;
if((crc&0x10000) !=0)
crc ^= 0x11021;
if((*ptr&i) != 0)
crc ^= 0x1021;
}
ptr++;
}
return crc;
}
16
12
5
+X
+X
+1 (0x1021), initial value: 0x0000.
16

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents