LINKS
LINKS
How to Config NLDC Product With Serial Command
Announcer: Stephen Time: 30th Jul 2021
Share to :
MORE
45 views 0 comments

Method1:Serial Command Based On Register Operation :

  • Read register

     The read command is used to read the contents of 1 to 256 contiguous registers in the engine.

     Syntax  : {Prefix1} {Types} {Lens} {Address} {Datas} {FCS}

     Prefix1 :  0x7E 0x00

     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: X16+X12+X5+1 (0x1021), initial value: 0x0000.

  • Reply of read register

     Reply: {Prefix2} {Types} {Lens} {Datas} {FCS}

     1) Success message:

     Prefix2 :  0x02 0x00

     Types   :  0x00 (success)

     Lens    :  The number of data returned. If Lens=0x00, that means values of 256 contiguous registers are returned.

     Datas   :  0x00~0xFF, data that are returned.

     FCS     :  CRC-CCITT checksum.

     2) CRC check failure message:

     Prefix2 :  0x02 0x00

     Types   :  0x01 (CRC check failure)

     Lens    :  0x01

     Datas   :  0x00

     FCS     :  CRC-CCITT checksum (0x04 0x01)

     3) Invalid command message:

     Prefix2 :  0x02 0x00

     Types   :  0x03 (invalid command)

     Lens    :  0x01

     Datas   :  0x00

     FCS     :  CRC-CCITT checksum (0x6A 0x61)

  • Write register

     The write command is used to write contiguous registers (1 to 256 registers) in the engine.

     Syntax  : {Prefix1} {Types} {Lens} {Address} {Datas} {FCS}

     Prefix1 :  0x7E 0x00 (2 bytes)

     Types   :  0x08 (1 byte)

     Lens    :  0x00~0xFF (1 byte), byte count, i.e. number of registers written. When Lens=0x00, 256 contiguous registers are to be written.

     Address :  0x0000~0xFFFF (2 bytes), starting register address.

     Datas   :  0x00~0xFF (1~256 bytes), data to be written into the register(s)

     FCS     :  CRC-CCITT checksum, 2 bytes.

                Computation sequence: Types+ Lens+Address+Datas; polynomial: X16+X12+X5+1 (0x1021), initial value: 0x0000.

  • Save register data in EEPROM

     The save command is used to save register data into an external EEPROM.

     Syntax: {Prefix1} {Types} {Lens} {Address} {Datas} {FCS}

     Prefix1 :  0x7E 0x00 

     Types   :  0x09

     Lens    :  0x01

     Address :  0x0000

     Datas   :  0x00

     FCS     :  CRC-CCITT checksum (0xDE 0xC8)

  • Reply of command write or save register

     Reply: {Prefix2} {Types} {Lens} {Datas} {FCS}

     1) Success message:

     Prefix2 :  0x02 0x00 

     Types   :  0x00 (success)

     Lens    :  0x01

     Datas   :  0x00

     FCS     :  CRC-CCITT checksum (0x33 0x31)

     2) CRC check failure message:

     Prefix2 :  0x02 0x00 

     Types   :  0x01 (CRC check failure)

     Lens    :  0x01

     Datas   :  0x00

     FCS     :  CRC-CCITT checksum (0x04 0x01)

     3) Invalid command message:

     Prefix2 :  0x02 0x00 

     Types   :  0x03 (invalid command)

     Lens    :  0x01

     Datas   :  0x00

     FCS     :  CRC-CCITT checksum (0x6A 0x61)

  • Example

     enable CODE ID prefix for all symbologies to EM3095 (engine embedded in FM30)

     1) the address of CODE ID prefix configuration in register is 0x0002, Bit 7

http://res.newland-id.com/misc/images/EM3095registerCODEIDprefix.png

     2) read present configuration from register 0x0002

7E 00 07 01 00 02 01 67 23

     3) get reply from EM3095

02 00 00 01 00 33 31

        the present state of register 0x0002 is 0000 0000(HEX 00)

     4) set register 0x0002 Bit 7 as "1", I.E. 1000 0000(HEX 80)

7E 00 08 01 00 02 80 83 73

     5) reply from EM3095

02 00 00 01 00 33 31

     6) save register

7E 00 09 01 00 00 00 DE C8

     7) reply from EM3095

02 00 00 01 00 33 31

 


 

Method 2: serial command based on programming command

Instance with EM3095, All user programmable features/options are described along with their programming barcodes/commands in the following sections.

http://res.newland-id.com/misc/images/EM3095programmingbarcodecommand.png

  • Command Programming

EM3095 can be configured by serial commands sent from the host device. Note that communication parameters on the engine and the host must match so that two devices can communicate with each other. The default settings of the engine are 9600bps, no parity check, 8 data bits, 1 stop bit, and no flow control. The engine uses 8-bit registers.

  • Relationship between Programming Command and Serial Command

1.Program general parameter with serial command

  A programming command (i.e. the characters under programming barcode) contains 7 characters. The function of each character is described in the table below.

1st Char

2nd Char~3rd Char

4th Char~5th Char

6th Char~7th Char

CMD

BITPOSITION

ADDR

DATA

"W"

"00"~"FF"

"00"~"FF"

"00"~"FF"

it means write a value (DATA) to the specified bits (BITPOSITION) of the register (ADDR).

Note:

     1) CMD: Command type.    

     2) BITPOSITION: Bit(s) the value is written to. For example, if only bit 3 is to be written, the BITPOSITION should be “08”; if all bits are to be

        written,the BITPOSITION should be “FF”.

     3) ADDR: Address of register to be written.

     4) DATA: Value written to the BITPOSITION.

The ADDR and DATA in programming command correspond to Address and Datas in serial command,respectively:

     1) If BITPOSITION="FF", the values of ADDR and DATA can be used directly in the write command.

        e.g., programming command: WFFD9D8  (write value 0xD8 to register 0x00D9)

              serial command sent: 0x7E 0x00 0x08 0x01 0x00 0xD9 0xD8 0x91 0x53

              reply received     : 0x02 0x00 0x00 0x01 0x00 0x33 0x31

     2) If BITPOSITION≠”FF”, users need to read the register content, calculate the value (Datas) and then write the value into the register, as shown

        in the following example.

        e.g., programming command: W030002  (write value 0x02 to bit1 and bit0 of register 0x0000)

        Step 1: Read the content of register 0x0000.

                serial command sent  : 0x7E 0x00 0x07 0x01 0x00 0x00 0x01 0x01 0x41

                reply received       : 0x02 0x00 0x00 0x01 0xD4 0xB8 0xC8

        Step 2: Calculate the value written to the register.

                Datas = (0xD4 & (! 0x03)) + 0x02 = 0xD6

        Step 3: Write the value into the register.

                serial command sent  : 0x7E 0x00 0x08 0x01 0x00 0x00 0xD6 0xDF 0x22

                reply received       : 0x02 0x00 0x00 0x01 0x00 0x33 0x31

2.Program special parameter with serial command

  The serial commands used for programming the following parameters are practically irrelevant to their programming commands.

Feature

Serial Command

Program the sensitivity level

0x7E 0x00 0x08 0x01 0x00 0x03 0xTT 0xSS 0xSS

Program the image stabilization timeout

0x7E 0x00 0x08 0x01 0x00 0x04 0xTT 0xSS 0xSS

Program the timeout between decodes

0x7E 0x00 0x08 0x01 0x00 0x05 0xTT 0xSS 0xSS

Program the decode session timeout

0x7E 0x00 0x08 0x01 0x00 0x06 0xTT 0xSS 0xSS

Note:

     TT: Value written to register. For example, to set the sensitivity level to 10, 0xTT should be 0x0A.

     SS: CRC checksum calculated.

3.Save register data in EEPROM

  Scanning a programming barcode can change register value and save register data in EEPROM as well. As for command programming, it requires a write command and

  a save command to perform these two tasks. To save register data in an external EEPROM, users need to send the save command to the engine.

  save command sent:  0x7E 0x00 0x09 0x01 0x00 0x00 0x00 0xDE 0xC8

  reply received   :  0x02 0x00 0x00 0x01 0x00 0x33 0x31

 

All comments (0)