Sunlux XL-3956 Series User manual

XL-3956 2D Barcode Scanner
User Manual

Table Of Contents
Revision History.................................................................................................................................................3
Chapter 1 Getting Started..................................................................................................................................1
Introduction..............................................................................................................................................1
About This Guide.....................................................................................................................................2
Connecting EVK to PC............................................................................................................................2
Barcode Scanning...................................................................................................................................2
Configuring the XL-3956..........................................................................................................................2
Barcode Programming......................................................................................................................2
Command Programming ..................................................................................................................2
Read Register............................................................................................................................3
Write Register............................................................................................................................6
Save Register Data in EEPROM.............................................................................................10
Relationship between Programming Command and Serial Command..................................11
Registers .................................................................................................................................13
Programming Barcode Data..................................................................................................................25
Factory Defaults.....................................................................................................................................25
Chapter 2 Communication Interface..............................................................................................................26
TTL-232 Interface (for XL-3956)............................................................................................................26
Baud Rate.......................................................................................................................................27
USB Interface (for XL-3956).............................................................................................................27
USB DATAPIPE..............................................................................................................................27
USB HID-KBW................................................................................................................................28
Standard Keyboard .................................................................................................................29
Emulate ALT+Keypad.............................................................................................................29
Function Key Mapping.............................................................................................................30
ASCII Function Key Mapping Table........................................................................................31
USB Country Keyboard Types................................................................................................32
Beep on Unknown Character..................................................................................................35
Inter-Keystroke Delay..............................................................................................................35
Caps Lock................................................................................................................................36
Convert Case...........................................................................................................................37
Emulate Numeric Keypad........................................................................................................38

USB COM Port Emulation..............................................................................................................39
HID-POS.........................................................................................................................................39
Access the Scanner with Your Program.................................................................................40
Acquire Scanned Data ............................................................................................................40
VID/PID....................................................................................................................................40
Chapter 3 Scan Mode.......................................................................................................................................41
Manual Mode.........................................................................................................................................41
Continuous Mode...................................................................................................................................42
Decode Session Timeout ...............................................................................................................42
Timeout between Decodes.............................................................................................................43
Sense Mode...........................................................................................................................................44
Decode Session Timeout ...............................................................................................................44
Timeout between Decodes.............................................................................................................45
Image Stabilization Timeout...........................................................................................................45
Sensitivity........................................................................................................................................46
Command Trigger Mode........................................................................................................................47
Decode Session Timeout ...............................................................................................................47
Chapter 4 Illumination & Aiming.....................................................................................................................48
Illumination.............................................................................................................................................48
Aiming....................................................................................................................................................49
Chapter 5 Notification......................................................................................................................................50
Mute Mode.............................................................................................................................................50
Good Read Beep...................................................................................................................................50
Good Read Beep Frequency..........................................................................................................51
Good Read Beep Duration.............................................................................................................51
Decode Result Notification....................................................................................................................52
Chapter 6 Data Formatting..............................................................................................................................53
AIM ID Prefix..........................................................................................................................................53
CODE ID Prefix......................................................................................................................................54
Terminating Character Suffix.................................................................................................................55
Chapter 7 Symbologies...................................................................................................................................56
General Settings....................................................................................................................................56
Enable/Disable All Symbologies.....................................................................................................56

Enable/Disable 1D Symbologies....................................................................................................56
Enable/Disable 2D Symbologies....................................................................................................56
Video Reverse................................................................................................................................57
1D Symbologies.....................................................................................................................................58
Code 128........................................................................................................................................58
Restore Factory Defaults.........................................................................................................58
Enable/Disable Code 128........................................................................................................58
UCC/EAN-128 (GS1-128) ..............................................................................................................59
Restore Factory Defaults.........................................................................................................59
Enable/Disable UCC/EAN-128................................................................................................59
AIM 128...........................................................................................................................................60
Restore Factory Defaults.........................................................................................................60
Enable/Disable AIM 128..........................................................................................................60
EAN-8 .............................................................................................................................................61
Restore Factory Defaults.........................................................................................................61
Enable/Disable EAN-8.............................................................................................................61
Transmit Check Digit...............................................................................................................61
Add-On Code...........................................................................................................................62
Add-On Code Required...........................................................................................................63
EAN-8 Extension.....................................................................................................................63
EAN-13 ...........................................................................................................................................64
Restore Factory Defaults.........................................................................................................64
Enable/Disable EAN-13...........................................................................................................64
Transmit Check Digit...............................................................................................................64
Add-On Code...........................................................................................................................65
Add-On Code Required...........................................................................................................66
ISSN................................................................................................................................................67
Restore Factory Defaults.........................................................................................................67
Enable/Disable ISSN...............................................................................................................67
ISBN................................................................................................................................................68
Restore Factory Defaults.........................................................................................................68
Enable/Disable ISBN...............................................................................................................68
Set ISBN Format .....................................................................................................................68
UPC-E.............................................................................................................................................69
Restore Factory Defaults.........................................................................................................69
Enable/Disable UPC-E............................................................................................................69
Transmit Check Digit...............................................................................................................69

Add-On Code...........................................................................................................................70
Add-On Code Required...........................................................................................................71
Transmit System Character ....................................................................................................71
UPC-E Extension ....................................................................................................................71
UPC-A.............................................................................................................................................72
Restore Factory Defaults.........................................................................................................72
Enable/Disable UPC-A............................................................................................................72
Transmit Check Digit...............................................................................................................72
Add-On Code...........................................................................................................................73
Add-On Code Required...........................................................................................................74
Transmit Preamble Character.................................................................................................74
Interleaved 2 of 5............................................................................................................................75
Restore Factory Defaults.........................................................................................................75
Enable/Disable Interleaved 2 of 5...........................................................................................75
Check Digit Verification...........................................................................................................76
Transmit Appended “0”............................................................................................................77
ITF-6 ...............................................................................................................................................78
ITF-14 .............................................................................................................................................79
Matrix 2 of 5....................................................................................................................................80
Restore Factory Defaults.........................................................................................................80
Enable/Disable Matrix 2 of 5...................................................................................................80
Check Digit Verification...........................................................................................................81
Industrial 25....................................................................................................................................82
Restore Factory Defaults.........................................................................................................82
Enable/Disable Industrial 25 ...................................................................................................82
Check Digit Verification...........................................................................................................83
Standard 25....................................................................................................................................84
Restore Factory Defaults.........................................................................................................84
Enable/Disable Standard 25 ...................................................................................................84
Check Digit Verification...........................................................................................................85
Code 39 ..........................................................................................................................................86
Restore Factory Defaults.........................................................................................................86
Enable/Disable Code 39..........................................................................................................86
Transmit Start/Stop Character ................................................................................................86
Check Digit Verification...........................................................................................................87
Enable/Disable Code 39 Full ASCII........................................................................................87
Codabar..........................................................................................................................................88

Restore Factory Defaults.........................................................................................................88
Enable/Disable Codabar .........................................................................................................88
Check Digit Verification...........................................................................................................89
Transmit Start/Stop Character ................................................................................................89
Start/Stop Character Format...................................................................................................90
Code 93 ..........................................................................................................................................91
Restore Factory Defaults.........................................................................................................91
Enable/Disable Code 93..........................................................................................................91
Check Digit Verification...........................................................................................................92
Code 11 ..........................................................................................................................................93
Restore Factory Defaults.........................................................................................................93
Enable/Disable Code 11..........................................................................................................93
Check Digit Verification...........................................................................................................94
Plessey ...........................................................................................................................................95
Restore Factory Defaults.........................................................................................................95
Enable/Disable Plessey...........................................................................................................95
Check Digit Verification...........................................................................................................96
MSI-Plessey....................................................................................................................................97
Restore Factory Defaults.........................................................................................................97
Enable/Disable MSI-Plessey...................................................................................................97
Check Digit Verification...........................................................................................................98
RSS-14 ...........................................................................................................................................99
Restore Factory Defaults.........................................................................................................99
Enable/Disable RSS-14...........................................................................................................99
Transmit Application Identifier “01” .........................................................................................99
RSS-Limited..................................................................................................................................100
Restore Factory Defaults.......................................................................................................100
Enable/Disable RSS-Limited.................................................................................................100
Transmit Application Identifier “01” .......................................................................................100
RSS-Expand.................................................................................................................................101
Restore Factory Defaults.......................................................................................................101
Enable/Disable RSS-Expand................................................................................................101
2D Symbologies...................................................................................................................................102
PDF417.........................................................................................................................................102
Restore Factory Defaults.......................................................................................................102
Enable/Disable PDF417........................................................................................................102
Data Matrix....................................................................................................................................103

Restore Factory Defaults.......................................................................................................103
Enable/Disable Data Matrix...................................................................................................103
Rectangular Barcodes...........................................................................................................103
Mirror Images ........................................................................................................................104
QR Code.......................................................................................................................................105
Restore Factory Defaults.......................................................................................................105
Enable/Disable QR Code......................................................................................................105
Micro QR ...............................................................................................................................105
Mirrored Micro QR.................................................................................................................106
Appendix.........................................................................................................................................................107
Appendix A: Factory Defaults Table....................................................................................................107
Appendix B: AIM ID Table...................................................................................................................113
Appendix C: Code ID Table.................................................................................................................116
Appendix D: ASCII Table.....................................................................................................................117
Appendix E: Parameter Programming Examples ...............................................................................121
Program the Decode Session Timeout........................................................................................121
Program the Timeout between Decodes......................................................................................121
Program the Image Stabilization Timeout....................................................................................121
Program the Sensitivity Level.......................................................................................................122
Appendix F: Digit Barcodes.................................................................................................................123
Appendix G: Save/Cancel Barcodes...................................................................................................126
Appendix H: Requently-Used Serial Commands................................................................................127


1
Chapter 1 Getting Started
Introduction
NLS-XL-3956 series embedded 2D barcode scan engines, armed with the SUNLUX , a
patented computerized image recognition system, bring about a new era of 2D barcode scan
engines.
The XL-3956’s 2D barcode decoder chip ingeniously blends technology and advanced chip design &
manufacturing, which significantly simplifies application design and delivers superior performance and
solid reliability with low power consumption.
The XL-3956 supports all mainstream 1D as well as PDF417, QR Code (QR1, QR2, Micro QR),
Data Matrix and GS1-DataBarTM(RSS) (RSS-Limited, RSS-14, RSS-14 Stacked and RSS-Expand).
The XL-3956 can read barcodes on virtually any medium - paper, plastic card, mobile phones and LCD
displays. It provides an ideal solution for both emerging mobile phone-based barcode applications, like
digital coupons, electronic tickets and boarding passes, and traditional applications.
This compact engine weighs only 3 grams and fits easily into even the most space-constrained
equipments such as data collectors, meter readers, ticket validators and PDAs. Moreover, the instant
power on/off feature along with ultra-low power consumption brings greater efficiency and convenience in
barcode scanning.

2
About This Guide
This guide provides programming instructions for the XL-3956. Users can configure the XL-3956
by scanning the programming barcodes included in this manual.
The XL-3956 has been properly configured for most applications and can be put into use without further
configuration. Users may check the Factory Defaults Table in Appendix for reference. Throughout the
manual, options marked with asterisks (**) are factory default values.
Connecting EVK to PC
The EVK tool is provided to assist users in application development for the XL-3956. TheEVK can
be connected to PC via the RS-232 or USB interface.
Barcode Scanning
Powered by area-imaging technology and SUNLUX patented technology, the XL-3956 features fast
scanning and accurate decoding. Barcodes rotated at any angle can still be read with ease. When
scanning a barcode, simply center the aiming beam projected by the XL-3956 over the barcode.
Configuring the XL-3956
There are two ways to configure the engine: barcode programming and command programming.
Barcode Programming
The XL-3956 can be configured by scanning programming barcodes. All user programmable features/
options are described along with their programming barcodes/commands in the following sections.

3
Command Programming
Besides the barcode programming method, the XL-3956can also 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.
Read Register
The read command is used to read the contents of 1 to 256 contiguous registers in the engine.
Format of read command: {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.
The following C language program is provided for reference.

4
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;
}

5
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)

6
Example:
Read the content (0x3E) of register 0x000A
1)Read operation succeeds:
Command sent: 0x7E 0x00 0x07 0x01 0x00 0x0A 0x01 0xEE 0x8A
Message received: 0x02 0x00 0x00 0x01 0x3E 0xE4 0xAC
2) CRC check fails:
Command sent: 0x7E 0x00 0x07 0x01 0x00 0x0A 0x01 0x11 0x22
Message received: 0x02 0x00 0x01 0x01 0x00 0x04 0x01
3)Situations that may cause the engine to respond with an invalid command message: Command sent is
shorter than the required length, or the third byte is not sent out within 400ms after the first two bytes
“0x7e 0x00”are sent
Command sent: 0x7E 0x00 0x07 0x01 0x00 0x0A 0x01
Message received:0x02 0x00 0x03 0x01 0x00 0x6A 0x61

7
Write Register
The write command is used to write contiguous registers (1 to 256 registers) in the engine.
Format of write command: {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.
The following C language program is provided for reference.

8
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
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)

10
Example:
Write 0x3E into register 0x000A
1) Write operation succeeds:
Command sent: 0x7E 0x00 0x08 0x01 0x00 0x0A 0x3E 0x4C 0xCF
Message received: 0x02 0x00 0x00 0x01 0x00 0x33 0x31
2) CRC check fails:
Command sent: 0x7E 0x00 0x08 0x01 0x00 0x0A 0x3E 0x11 0x22
Message received: 0x02 0x00 0x01 0x01 0x00 0x04 0x01
3) Situations that may cause the engine to respond with an invalid command message: Command sent is
shorter than the required length, or the third byte is not sent out within 400ms after the first two bytes
“0x7e 0x00”are sent
Command sent: 0x7E 0x00 0x08 0x01 0x00 0x0A 0x3E
Message received: 0x02 0x00 0x03 0x01 0x00 0x6A 0x61

11
Save Register Data in EEPROM
The save command is used to save register data into an external EEPROM.
Format of save command: {Prefix1} {Types} {Lens} {Address} {Datas} {FCS}
Prefix1 : 0x7E 0x00
Types : 0x09
Lens : 0x01
Address: 0x0000
Datas : 0x00
FCS : CRC-CCITT checksum (0xDE 0xC8)
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)

12
3) Invalid command message:
Prefix2 : 0x02 0x00
Types : 0x03 (invalid command)
Lens : 0x01
Datas : 0x00
FCS : CRC-CCITT checksum (0x6A 0x61)
Table of contents