Read Register
El comando register read se utiliza para leer el contenido de registros contiguos 1 y 256 en el escáner.
Syntax: {Prefix1} {Types} {Lens} {Address} {Datas} {FCS}
Prefix1 :
0x7E 0x00 (2 bytes)
Types
: 0x07 (1 byte)
Lens
: 0x01 (1 byte).
Address:
Datas
: 0x00~0xFF (1 byte), number of registers to be read. When Datas=0x00, 256
FCS
: CRC-CCITT checksum (2 bytes)
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;
}
9
0x0000~0xFFFF (2 bytes), starting register address.
contiguous registers are to be read.
Computation sequence: Types+ Lens+Address+Datas;
16
12
polynomial: X
+X
+X
The following C language program is provided for reference.
5
+1(0x1021), initial value: 0x0000.
** Enter Setup
Exit Setup