条码扫描器接口编程(C#)
C# 生成、识别条形码(Bar Code)和二维码(QR Code)

C# 生成、识别条形码(BarCode)和二维码(QR Code)
能够用于生成和识别条形码和二维码的第三方控件很多,这里介绍如何使用Free Spire.Barcode来实现这些操作。
第一步:通过Visual Studio 2015的NuGet Package Manager下载安装免费版Spire.Barcode
第二步:直接进入代码编写
1.创建条形码
2.创建二维码
3. 读取条码/二维码
如果一张图片上只有一个条形码或二维码,可以用ScanOne来返回一个string类型的值:
如果一张图片上不止一个条形码或二维码,可以用Scan方法来返回一个sting[]类型的字符串集合:
注:生成的图片中带有E-ICEBLUE字样,去除水印的代码如下。
其中的key值需要发邮件联系E-iceblue公司免费获取。
BarcodeSettings.ApplyKey("......");
《本文完》。
Intermec和TSC常见故障及处理

Intermec和TSC常见故障及处理深圳市仁伟达科技有限公司2009年05月23日Intermec3400.3440.3600打印机故障排除1、标签上有污迹。
(1)、打印机头不洁。
清洁打印机头。
(2)、标签质量或者色带太差。
更换成Inermec标签及(或)碳带。
(3)、打印介质的敏感度设置不正确。
改变敏感度设定,使之符合正在使用的介质类型。
2、字迹太浅或者太深(1)、敏感度指令设置不正确。
改变敏感度设定,使之符合正在使用的介质类型。
(2)、打印机头不洁。
清洁打印机头。
3、字没有打在标签上。
打印机进纸不当。
检查并确保色带安装正常。
1、打字质量太差。
(1)、介质敏感度不正确。
改变敏感度设定,使之符合正在使用的介质类型。
(2)、打印机头不洁。
清洁打印头。
(3)、打印对比度不均匀(密度)。
调节偏调螺丝。
(4)、使用不当的标签与色带型号打印。
(5)、色带有褶皱。
检查色带安装是否正确,调节偏调螺丝。
5、直接热敏/热感应开关设定的位置不对。
把DIP的开关设定在正使用的介质型号上。
扫描枪常见问题1、扫描器不工作一、扫描器未通电。
检查系统电源确保已连接电源。
二、使用了不正确的接口电缆。
确保使用了正确的接口电缆。
三、接口/电源电缆松动。
确保所有电缆连接已固定。
2、扫描器不对条码解码。
一、未按条码类型对扫描器编程。
确保已对扫描器编程,使其可读取要扫描的条码类型。
二、条码不可读。
确保条码无缺陷,尝试扫面具有相同条码类型的测试条码。
三、扫描器与条码间的距离不正确。
将扫描器移近或远离条码。
3、扫描器正在对条码解码,但尚未将数据传输到主机。
一、未按正确的接口主机接口对扫描器编程。
扫描适当的主机参数条码。
二、接口电缆松动。
确保所有电缆连接已固定。
4、扫描数据在主机上显示不正确。
未按正确的主机接口对扫描器编程。
扫描适当的主机参数条码。
扫描器蜂鸣器指示标准使用低/中/高蜂鸣声开机短而中的蜂鸣声条码已解码长而低的蜂鸣声检测到传输错误,数据被忽略参数菜单扫描高/低/高/低蜂鸣声已成功设置参数高/低蜂鸣声已执行正确的编程序列低/高蜂鸣声编程序列不正确,或扫描了“取消”条码扫描器LCD指示关闭扫描器已打开并已作好扫描准备,但扫描器未通电。
.NETC#利用ZXing生成、识别二维码条形码

.NETC#利⽤ZXing⽣成、识别⼆维码条形码⼀、⾸先下载 然后将对应版本 .dll 拖⼊项⽬中,再引⽤之。
主要是⽤ BarcodeWriter、BarcodeReader。
⼆、⽣成⼆维码.NET 平台的代码始终要简单些。
QrCodeEncodingOptions options = new QrCodeEncodingOptions();options.CharacterSet = "UTF-8";options.DisableECI = true; // Extended Channel Interpretation (ECI) 主要⽤于特殊的字符集。
并不是所有的扫描器都⽀持这种编码。
options.ErrorCorrection = ZXing.QrCode.Internal.ErrorCorrectionLevel.H; // 纠错级别options.Width = 300;options.Height = 300;options.Margin = 1;// options.Hints,更多属性,也可以在这⾥添加。
BarcodeWriter writer = new BarcodeWriter();writer.Format = BarcodeFormat.QR_CODE;writer.Options = options;Response.Clear();using (Bitmap bmp = writer.Write("")) // Write 具备⽣成、写⼊两个功能{MemoryStream ms = new MemoryStream();{bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png);Response.ContentType = "image/png";Response.BinaryWrite(ms.ToArray());}}Response.End();纠错级别:1. L - 约 7% 纠错能⼒。
Barcode 扫描器 模块 用户 手册说明书

Barcode Scanner ModuleUser ManualThis is a small 1D/2D codes reader, by using the intelligent image recognition algorithm, it will decode the barcode or 2D code on paper or screen, fast and accurately.Through the onboard USB and UART interface, it can be directly plugged into a computer, or be easily integrated to kinds of devices due to its small form factor. FEATURES⚫Easy to use, requires no knowledges of image recognition⚫Decodes various common 1D/2D codes such as Barcode, QR code etc.⚫Onboard micro USB and UART serial port, allows to connect with computers or embedded devices⚫Configurable via scanning 'configuration code'⚫Onboard light source, works in the darkSPECIFICATIONSOverview (1)Features (1)Specifications (2)Support barcodes (5)Scanning Instructions (6)Scanning Area (6)Scanning Way (7)Setting Instruction (9)Hardware connection (9)Setting Codes (9)Setting code (9)Restore Factory Setting (10)Users Default Setting (11)UART Communication (11)USB Communication (12)Scanning Mode (13)Lighting and Targeting (18)Ouput indication (19)Data Edit (23)Barcode types Enable/Diable (34)Appendix A: Default setting table (45)Appendix B: Common UART command (47)Appendix C: CODE ID List (48)Appendix D: ASCII table (49)Appendix E: Data Code (55)Appendix F: Save and Remove (57)✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓✓SCANNING AREAScanning distance: These values are all be measured indoor (250 lux)The min distance is based on the length of barcode and the scanning angle.If you want to house the scanner with window, please note that:⚫The window should be colorless⚫Check the surface of window carefully, make sure they are clean, smooth and have not scratch.⚫Let the windows cave in the case⚫Paralleling window with scanner without skew. If you locate the window improperly, it will down the scanning performance.⚫The window should close to and be in front of the scanner reader (don’t touch) The distance between window and scanner protect the scanner from drop and crash. SCANNING WAYWhile using the Barcode Scanner Module to scan 1D/2D barcodes, it allows some tilt, skew and pitch. However, you had better to reduce them for better and faster scanning result.TiltYou must keep the barcode inside thearea of white light. If the barcode is inside thescanning area, the tilt angle could be 360°. Toimprove the scanning rate, recommend tokeep vertical scanning.SkewSkew will reduce the width and space of barcode (scanned), it is the threshold dimension of high density barcode. It supports up to 65°. However, you’d better reduce the skew for better and faster scanning.PitchPitch will decrease the height of barcode. 2° to 3° is the best scanning angle, which could avoid the direct reflection of barcode. Barcode Scanner Module supports up to 60° pitch angle. But you should reduce it for better and faster scanning.Setting commands are provided, you could refer to this chapter to configure the Barcode Scanner Module. The factory setting could meet the requirement of common using, users need not more setting.HARDWARE CONNECTIONThis module supports two communicating interfaces. You can connect the USB interface to your device with micro USB cable. Or you can connect the UART interface to your device. If you want to test the UART interface with PC, you require an TTL to USB board like our CP2102 (should be purchased separately).VCC: 5VTx: Transmit Pin (Connect to Rx of MCU/CP2102)Rx: Receive Pin (Connect to Tx of MCU/CP2102)GND: GroundSETTING CODESUsers could scan the setting codes to configure the Barcode Scanner Module SETTING CODEYou can scan these two codes to enable/disable the setting code function. Enable it, you could scan setting codes for configuration. And setting code is invalid if disable.Open/Close:Output content:RESTORE FACTORY SETTINGYou can scan this setting code to restore to factory setting if require.Open Setting Code FunctionClose Setting Code FunctionDon't Output Content ofSetting CodeOutput Content of Setting CodeRestore Factory SettingUSERS DEFAULT SETTINGExcept the factory setting, users can save the setting as user default setting. By scanning the “Save Current Setting as User Default Setting” code, you can save your current setting as default setting. If there was default setting, and this operating will cover the old information.By scann ing the code “Restore User Default Setting” can restore the module to user default setting.UART COMMUNICATIONIf you connect the module to MCU by UART interface. You must set the correct UART communication parameters for success communicating. The default parameters of UART interface of module are that: Baud rate: 9600bps, Data bit: 8, Stop bit: 1 Scanning this setting code, it switches the communication interface to UART.Save Current Setting as UserDefault Setting Restore User Default SettingUART Output1.Baud rate Setting1200bps4800bps*9600bps14400bps19600bps38400bps57600bps115200bps USB COMMUNICATIONB PC KeyboardWhen you connect the module with USB cable, you can set the module to keyboard input mode by scanning this code.USB PC KeyboardB Virtual PortYou can set the module to USB virtual port mode by scanning this code.USB Virtual PortSCANNING MODE1.Manual ModeManual Mode is default scanning mode. In this mode, user should press thebutton to begin scanning, and it will finish after scanned or button release.Manual ModeSleepIn manual mode, module could enter sleep mode if it being idle for some time. You can scan this code to configure this function.Enable Sleep Function Disable Sleep FunctionDefault setting is that the module will enter Sleep mode after 30s if module keeps idle. And you can wake it up by press button, module will restart after waking.2.Continuous ModeIn Continuous Mode, the module will keep scanning automatically. After it success scanning and output result, or reach the timeout of scanning time, the module will begin its next scan after a certain time (configurable). User should single press the button to stop the scanning and single press again to continue.Continuous ModeSingle Scanning TimeIn Continuous Mode, this parameter set the max scanning time for per scanning behavior. If the module success scanning or the its scanning time reach the max1000ms3000ms*5000ms infinitesingle scanning time, module will enter the non-scanning interval. The range of single scanning time should be 0.1~25.5s. If it is set to 0, it means that scanning time is infinite. It is 5.0s by default.It is the interval between two scanning behaviors. That is module will scan nothing after last scanning for this interval time before and begin its next scanning. The setting range of this interval is 0~25.5s. It is 1.0s by default.No Interval500ms*1000ms1500ms2000ms3.Sensing ModeIn Sensing Mode, the module will detect the ambient brightness, if the brightness change, module will begin scanning after an image stabilization time (configurable). After one scanning (success or timeout), module will enter detecting state again after a certain time (configurable). Module will keep this cycle unless: If timeout, module will stop scanning and in detecting state automatically. In Sensing Mode, user could also press the button to scan and module will back to detecting after success scanning or button release.Sensing ModeIn Sensing Mode, this parameter set the max scanning time for per scanning behavior. If the module success scanning or the its scanning time reach the max single scanning time, module will enter the non-scanning interval. The range of single scanning time should be 0.1~25.5s. If it is set to 0, it means that scanning time is infinite. It is 5.0s by default1000ms3000ms*5000ms Infinite Non-Scanning IntervalIt is the interval between scanning and detecting. That is module will scan nothing after last scanning for this interval time before and begin its next detecting. The setting range of this interval is 0~25.5s. It is 1.0s by default.No Interval500ms*1000ms1500ms2000msImage stabilization timeIt is the time for module to stabilizing image if brightness changed is detected in sensing mode. The range is 0~25.5s, and 0.4s by default.100ms*400ms1000ms2000msmand ModeIn command mode, scanner will begin scanning after receive the command from MCU. (That is set bit0 to 1 on address 0x0002).Command ModeNote: The scanning command (UART) is that:7E 00 08 01 00 02 01 AB CD. The scanner module will response bytes (02 00 00 01 00 33 31) for the command and begin scanning at the same time.Single Scanning TimeIn command mode, this parameter set the max scanning time for per scanningbehavior. If the module success scanning or the its scanning time reach the max single scanning time, module will enter the non-scanning interval. The range of single scanning time should be 0.1~25.5s. If it is set to 0, it means that scanning time is infinite. It is 5.0s by default.LIGHTING AND TARGETING1. LightingThe white LED provides light for scanning, to improve the scanning performance and supports weak light environments. It has three states for choice:1000ms 3000ms*5000ms infiniteStandard (default): The LED only turn on when scanning, or it keeps off.Keep lighting: The LED will keep lighting after powering on scanner module No light: The LED is turned off all the time.*Standard Keep lighting No light2.TargetingThe targeting light beam could help user to get the best scanning distance and angle. User can set it:Standard (default): The LED only turn on when scanning, or it keeps off.Keep lighting: The LED will keep lighting after powering on scanner module No targeting: The LED is turned off all the time*Standard keep lighting No targetingOUPUT INDICATION1.All warning tonesYou can set the buzzer to active/passive buzzer, as well as setting the drivingfrequency of passive buzzer.Note:LF: Low frequency;MF: Midium frequency;HF: High frequencyIn active driving mode, user can set the working level of buzzer.User can turn off all the warning tones by use the code “Enable silence”.Driving frequency-Passive LF *Driving frequency-Passive MFDriving frequency-Passive HF Driving frequency-Active*Working level-High Working level-LowEnable silence *Disable Silence2. Scanned toneWith these code, you can set the buzzer behavior when succeed in scanning barcode.The time of the warning tone can also be set, it is default 60ms.3. Decoding promptYou can enable this function for MCU to know whether succeed in decoding. After enable this function, module will send prompt character “F” if it failed decoding and “S” if success.*Open Scanned toneClose Scanned tone*Tone time-60msTone time-30ms Tone time-90msTone time-120ms*Don't output decodingpromptOutput decodingprompt4.Keyboard settingTo compatible with different keyboard layout of different countries. There are keyboard setting code for choosing.*Keyboard-US Keyboard-Czech Keyboard-French Keyboard-German Keyboard-Hungarian Keyboard-ItalianKeyboard-Japanese Keyboard-Spanish5.Image flipSometimes we may need to flip the barcode as belowIf your barcode is flipped, you can use the flip mode.Enter flipped mode*Normal mode6.Read version informationYou can read the version information of module with this setting code.Read version informationDATA EDITSometimes we need to edit the scanned data first before output for easily handling.Data edit includes:⚫Add Prefix⚫Add Suffix⚫Decoding Data intercepting⚫Output CodeID of barcode⚫RF information for failed decoding⚫Add terminator TailThe format of Data is as below after edit:【Prefix】【CodeID】【Data】【Suffix】【Tail】1.PrefixAdd prefixProfix is a definable string added in front of decoding data, user can edit it by scanning the related setting codeAllow prefix adding Without prefix Modify prefixY ou can scan “Modify pr e fix” code and data setting code to modify the pr efix.Every character has two HEX and every prefix should less than 16 characters. The Hex of character refer to Appendix DModify prefixExample: Modify the prefix as “DATA”1)Q uery the character table to get the HEX of “DATA” are that : “44”,“41”,”54”, “41”2)Make sure Setting code is enabled, if no, please scanning the setting code“Open Setting Cod e Function”3)S canning “Modify pr e fix”code4)Scanning the data setting code one by one: “4”, “4”, “4”, “1”,“5”, “4”, “4”, “1”5)S canning “Save” Setting code2.SuffixAdd suffixSuffix is definable string added after decoding information.Allow Suffix Adding*Without Suffix Modify SuffixThe suffix can be modified as same as the Prefix.Modify SuffixExample: Modify the Suffix as “DATA”1)Q uery the character table to get the HEX of “DATA” are that : “44”,“41”,”54”, “41”2)Make sure Setting code is enabled, if no, please scanning the setting code“Open Setting Cod e Function”3)S canning “Modify prefix”code4)Scanning the data setting code one by one: “4”, “4”, “4”, “1”,“5”, “4”, “4”, “1”5)S canning “Save” Setting code3.CODE IDAdd CODE IDUser can use CODE ID to identify different type of barcode. CODE ID is chagnable.Every CODE ID has one character.Allow Adding CODE ID*Without CODE IDDefault CODE IDUsing “Default CODE ID” code, the module will restore all barcode information to default code id. The default setting should refer to Appendix CDefault CODE IDChange CODE IDUser can change the Code ID as they want with related setting codes. Every code id has one character (one HEX value). More details about characters, please refer to Appendix DE xample: change the CODE ID of CODE 128 to “A”1)Query the HEX value of “A” is “41”2)Make sure Setting code is enabled, if no, please scanning the setting code“Open Setting Cod e Function”3)S canning setting code “Modify CODE ID of CODE 128”4)S canning data setting codes “4”, ”1”5)S canning setting code “Save”Change CODE ID ListModify CODE ID of EAN 13Modify CODE ID of EAN8Modify CODE ID of UPCA Modify CODE ID of UPCE0 Modify CODE ID of UPCE1Modify CODE ID of CODE 128 Modify CODE ID of CODE 39Modify CODE ID of CODE 93Modify CODE ID of CODE BAR Modify CODE ID of Interleaved2 of 5Modify CODE ID of Industrial 25Modify CODE ID of Matrix 2 of 5Modify CODE ID of CODE 11Modify CODE ID of MSIModify CODE ID of RSS Modify CODE ID ofLimited RSSModify CODE ID of Expanded RSS Modify CODE ID of QR CODEModify CODE ID of Data Matrix Modify CODE ID of Limited PDF4174. TerminatorScanner will output a terminator after succeed in decoding.5. Data segment interceptThe decoding data 【Data 】could be divided to three parts:【Start 】【Center 】【End 】The length of Start and End segments can be set:Close Tail*Add Tail CRAdd Tail TAB Add Tail CRLF*Send whole Data Only Send Start SegmentOnly Send End SegmentOnly Send CenterSegmentChange the Length M of StartWith data setting code and this one, you can change the length of Start segment.The length of Start is max 255 characters.The Length M is represented by a HEX. More details about HEX refer to Appendix DModify the Length MChange the Length N of EndWith data setting code and this one, you can change the length of End segment.The length of Start is max 255 characters.The Length N is represented by a HEX. More details about HEX refer to Appendix DModify the Length NExamples:⚫D ecoding Data: “1234567890123ABC”, output the first thirteen bytes: “1234567890123”(Only Start)1) Query the characters table to get the HEX value of “13”(DEC) is “0D”2) Make sure the setting code function is enable, if not, open it.3) Scanning “Modify the Length M”4) scanning setting co de: “0”, “D”5) Scanning “Save”6) Scanning “Only Send Start Segment”⚫D ecoding Data: “1234567890123ABC”, output the last three bytes: “ABC”(Only End)1) Query characters table, get the HEX value of “3” (DEC) is “03”2) Make sure the setting code function is enable, if not, open it.3) S canning “Modify the length N”4) Scanning setting code: “0”. “3”5) Scanning “Save”6) Scanning “Only Send End Segment”⚫D ecoding Data: “1234567890123ABC”, output the center four bytes “0123”(Only Center)1) Query characters table, get the HEX value of “10” (DEC) and “3” are “0A”and “03” separately2) Make sure the setting code function is enable, if not, open it.3) Scanning “Modify the Length N”4) Scanning setting code: “0”. “3”5) Scanning “Save”7) Scanning setting code “0”, “A”5) Scanning “Save”6) Scanning “Only Send Center Segment”6.RF InformationRF (Read Fail) information is the that used for indicating failed scanning in some modes.Send RF Information*Without RF Information Modify InformationThe RF information can be modified by users. The max length of RF is 15 and every character represented by two HEX values. (Appendix D)Modify RF InformationE xample: Modify the RF information as “FAIL”1)Query characters table to get the HEX values of “FAIL” are “46”, “41”,“49”, “4C”2)Make sure setting code function is enabled, if not, please enable it.4)S canning data setting code: “4”, “6”, “4”, “1”, “4”, “9”, “4”,“C”5)S canning “Save”BARCODE TYPES ENABLE/DIABLE1.All Types EnableWith these setting code, you can enable/disable all types of barcode. If you disable all types of barcode, only the setting code is scannable.Enable All Types Disable All Types*Enable Default Types2.Barcode RotatingYou can enable the function that supports 360° rotation. Disable this function can improve decoding speed.*Enable 360°Rotation Disable 360°Rotation 3.EAN13Enable/Disable ENA13 barcode*Enable Scanning EAN13 Disable Scanning EAN13 4.EAN8Enable/Disable EAN9 barcode*Enable Scanning EAN8Disable Scanning EAN8 5.UPCAEnable/Disable UPCA barcode*Enable Scanning UPCA Disable Scanning UPCA6. UPCE0Enable/Disable UPCE0 barcode7. UPCE1Enable/Disable UPCE1 barcode8. Code128Enable/Disable Code128 barcodeSetting the Min Scannable Length of Code128:*Enable Scanning UPCE0Disable Scanning UPCE0*Enable Scanning UPCE1Disable Scanning UPCE1*Enable Scanning Code128Disable Scanning Code128Code128 Min Length 0 *Code128 Min Length 4Setting the Max scannable length of Code128:*Code128 Max Length 32Code128 Max Length 255 9.Code 39Enable/Disable Code39*Enable Scanning Code39Disable Scanning Code39 Setting the Min scannable length of Code39:Code39 Min Length 0*Code39 Min Length 4 Setting the Max Scannable length of Code39:*Code39 Max Length 32Code39 Max Length 255 10.Code93Enable/Disable Code93 barcode*Enable Scanning Code93Disable Scanning Code93 Setting the Min scannable length of Code93:Code93 Min Length 0*Code93 Min Length 4 Setting the Max scannable length of Code93:*Code93 Max Length 32Code93 Max Length 255 11.Code BarEnable/Disable Code Bar barcode*Enable Scanning Code Bar Disable Scanning Code BarSetting Start/Stop characters of Code Bar:Setting the min scannable length of Bar CodeSetting the max scannable length of Bar Code12. QREnable/Disable QR code13. Interleaved 2 of 5Enable/Disable Interleaved 2 of 5 codeSend Code Bar Start/StopCharacter*Without Code Bar Start/StopCharacterCode Bar Min Length 0*Code Bar Min Length 4*Code Bar Max Length 32 Code Bar Max Length 255*Enable Scanning QRDisable Scanning QREnable Scanning Interleaved 2 of 5*Disable Scanning Interleaved 2 of 5 Setting the min scannable length of Interleaved 2 of 5 code:Interleaved 2 of 5 Min Lenght 0* Interleaved 2 of 5 Max Length 4 Setting the max scannable length of interleaved 2 of 5 code:* Interleaved 2 of 5 Min Length 32Interleaved 2 of 5 Max Length 255 14.Industrial 25Enable/Disable Industrial 25 codeEnable Scanning Industrial 25*Disable Scanning Industrial 25 Setting the min scannable length of Industrial 25Industrial 25 Min Lenght 0* Industrial 25 max Length 4 Setting the max scannable length of Industrial 25:* Industrial 25 Max Lenght 32Industrial 25 Max Length 255 15.Matrix 2 of 5Enable/Disable scanning Matrix 2 of 5 code:Enable Scanning Matrix 2 of 5*Disable Scanning Matrix 2 of 5 Setting the min scannable length of Matrix 2 of 5Matrix 2 of 5 Min Length 0* Matrix 2 of 5 Min Length 4Setting the max scannable length of Matrix 2 of 5* Matrix 2 of 5 Max Length 32Matrix 2 of 5 Max Length 255 16.Code11Enable/Disable Scanning Code11Enable Scanning Code11*Disable Scanning Code11 Setting the min scannable length of Code11:Code11 Min Length 0*Code11 Min Length 4 Setting the max scannable length of Code11:*Code11 Max Length 32Code11 Max Length 25517. MSIEnable/Disable scanning MSI codeSetting the min scannable length of MSI:Setting the max scannable length of MSI:18. RSSEnable/Disable scanning RSS-14Enable Scanning MSI*Disable Scannig MSIMSI Min Length 0*MSI Min Length 4* MSI Max Length 32 MSI Max Length 255Enable Scanning RSS-14*Disable Scanning RSS-14Enable/Disable scanning Limited RSSEnable Scanning Limited RSS*Disable Scanning Limited RSS Enable/Disable scanning Expanded RSSEnable Scanning Expanded RSS*Disable Scanning Expanded RSS Setting the min scannable length of RSSRSS Min Length 0*RSS Min Length 4 Setting the max scannable length of RSS* RSS Max Length 32RSS Max Length 255 19.DMEnable/Disable Scanning DM code20.PDF417Enable/Disable scanning PDF417 code:APPENDIX A: DEFAULT SETTING TABLEParameters Default Setting Note Communicating InterfaceUARTBaud rate 9600Parity NoneData bit 8Stop bit 1Flow control None*Enable Scanning DM Disable Scanning DM *Enable Scanning PDF417Disable Scanning PDF417APPENDIX B: COMMON UART COMMANDAfter sending the query command of baud rate, the module will response as below:Note: SS SS is checksumAPPENDIX C: CODE ID LISTAPPENDIX D: ASCII TABLE。
c zxing 例子

c zxing 例子
ZXing是一个用Java编写的开源条形码/二维码扫描库,它提供了丰富的功能和灵活的API,可以用于在移动设备和桌面应用程序中实现条形码和二维码的扫描和生成。
下面我会给出一些关于ZXing的例子:
1. 扫描条形码/二维码,使用ZXing库可以轻松实现在移动设备上扫描条形码和二维码的功能。
开发人员可以通过调用库中提供的方法,实现相机的调用和扫描结果的处理,从而实现扫描功能。
2. 生成二维码,ZXing库提供了生成二维码的功能,开发人员可以根据自己的需求,调用库中的方法,传入相应的参数,生成自定义内容的二维码图片。
3. 解析条形码/二维码,使用ZXing库可以轻松实现对条形码和二维码的解析功能,开发人员可以通过调用库中提供的方法,对扫描到的条形码和二维码进行解析,获取其中的信息。
4. 自定义扫描界面,ZXing库提供了丰富的API和样式定制功能,开发人员可以根据自己的需求,自定义扫描界面的样式和交互
逻辑,从而实现个性化的扫描界面。
5. 集成ZXing库到应用程序中,开发人员可以通过引入ZXing 库的依赖,或者直接将库的源代码集成到自己的应用程序中,从而实现条形码和二维码相关功能的集成。
总之,ZXing库提供了丰富的功能和灵活的API,可以帮助开发人员轻松实现条形码和二维码的扫描、生成和解析功能,并且提供了样式定制和个性化定制的能力,非常适合在移动设备和桌面应用程序中使用。
QT编程下条码扫描器的实现

QT编程下条码扫描器的实现在凌动嵌入式系统UP-ATOM510平台上,结合LS1902系列手持激光条码扫描器,实现了QT集成开发环境下条码扫描器的应用。
标签:凌动嵌入式系统;QT编程;LS1902条码扫描器引言条形码技术具有输入速度快、采集信息量大、制作使用成本低廉等优点,并被认为是目前最经济实用的自动识别技术之一[1]。
它广泛应用在工商业、仓储物流、交通运输、医疗卫生等领域。
文章在UP-ATOM510嵌入式平台上实现了LS1902系列手持激光条码扫描器的应用,并利用QT实现了界面设计。
1 系统开发环境1.1 QT软件开发环境QT是一种跨平台图形用户界面开发库,和同类型的其他产品相比,它具有优良的跨平台特性、高度的模块化、支持2D/3D图形渲染,并且允许真正地组件编程等优良特性。
因此,可以说QT提供给应用程序开发者建立艺术级的图形用户界面所需的所有功能。
1.2 UP-ATOM510硬件平台UP-Atom510采用凌动Z系列处理器搭配Intel us15w单芯片系统控制器,功耗远远低于传统的x86双桥片架构,而且保持X86的兼容性,其操作系统采用以桌面应用为主的Ubuntu操作系统[2]。
1.3 LS1902条码扫描器LS1902系列手持激光条码扫描器是Symbol公司制造的新一代的商用激光条码扫描器。
它扫描线清晰可见,扫描速度达到每秒44次,并且价格适中。
同时,具有RS232,USB 等多种接口,有利于主机扩展设备。
2 QT图形界面设计及初始化本设计涉及到存储的项目有条码号、商品名称、单价、数量这四项,所以要预设settings.txt存储格式。
然后,建立QT工程文件Widget并进行UI界面设计,设计界面如1所示。
图1 条码扫描系统QT界面程序在使用过程中读取到条码号之后,需要将条码号及相关信息保存,这需要建立一个配置文件来进行保存。
QT提供的bool QFile::open(Open Mode mode)[virtual]的函数可以完成此功能。
vndetectbarcodesrequest oc代码

vndetectbarcodesrequest oc代码以下是一篇关于vndetectbarcodesrequest oc代码的文章:标题:详解vndetectbarcodesrequest oc代码:使用步骤和实用技巧引言:在现代社会中,激光扫描仪和数字相机已广泛应用于条形码和二维码的扫描。
在移动应用程序开发中,通过使用合适的API,可以很容易地实现条形码和二维码的识别功能。
VNBarcodeScannerKit是一个开源的Objective-C库,它提供了一种简单有效的方式来处理条形码和二维码的扫描。
本文将一步一步回答关于vndetectbarcodesrequest oc代码的使用方法,并分享一些实用技巧。
正文:第一步:安装VNBarcodeScannerKit库在开始使用vndetectbarcodesrequest oc代码之前,我们需要先安装VNBarcodeScannerKit库。
可以通过CocoaPods或手动下载并添加库文件到项目中进行安装。
确保在项目对应的Podfile文件中添加了`pod 'VNBarcodeScannerKit'`,然后执行`pod install`命令安装该库。
第二步:导入VNBarcodeScannerKit库安装完成后,我们需要在我们的OC代码中导入VNBarcodeScannerKit 库。
可以通过添加`#import<VNBarcodeScannerKit/VNBarcodeScannerKit.h>`语句来实现。
第三步:创建VNBarcodeScannerViewController实例现在我们可以创建一个VNBarcodeScannerViewController实例,并将其添加到现有的视图层次结构中。
代码如下:VNBarcodeScannerViewController *scannerViewController = [[VNBarcodeScannerViewController alloc] init];[self addChildViewController:scannerViewController];[self.view addSubview:scannerViewController.view]; scannerViewController.view.frame = self.view.bounds; [scannerViewController didMoveToParentViewController:self];第四步:实现VNBarcodeScannerViewControllerDelegate协议在我们的OC代码中,我们需要实现VNBarcodeScannerViewControllerDelegate协议,以便在扫描到条形码或二维码时进行相应的处理。
条码扫描仪设置方法

条码扫描仪设置方法第一步:打开设置软件Metrologic.第二步:打开Industrial Scanners(工业扫描器),双击Holotrak(全息解码技术)进入软件。
第三步:双击Com Ports(COM端口)设置COM口。
第四步:设置条码,目前是两种条码。
(1)、I2of5:勾选Enable Interleaved(开启交叉二五码)。
更改Lock1值为8,Lock2值为2 。
(2)、Code 128:勾选Enable Code128(启用Code128码)。
第五步:双击Misc/Code Length(杂项/代码长度),勾选Enable segmented decoding(启用分段解码)。
设置Min值为2,设置Lock值为0。
第六步:双击Reserved Codes(保留的代码)。
勾选使用的程序Reserve Code5(储备代码5)和Infinite same symbol timeout[7](无限相同的符号超时[7])。
双击Misc,设置Redundancy Count(冗余数)为5,Custom Configuration byte(自定义配置字节)为0。
如果使用控制盒,则要设置如下:打开Industrial Options(工业选项),双击Line Sensor(线传感器)。
设置Scans per Activation(扫描每激活)为3,Scanner activation time (扫描器激活时间)为3.0。
勾选Support package detect(支持包检测),and Scan duration time(扫描持续时间),and Transmit no read message (传输没有读消息),and Buffer all scans until cycle completes(缓冲直到周期完成所有扫描)。
控制器型号:MX001连接线:MX001-IS8550光电开头:NPN /PNP其中一种。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
条码扫描器接口编程(C#)3年前写了一篇《USB口的红外条形码扫描器的另类使用》,不过相关代码是VB编写,在这几年之间,有许多网友提出需要C#版的,起初还以为由VB修改C#应该很容易,最近研究了一下,发现C#和VB调用API的机制还是有所不同的,在迁移的过程中还是会遇到不少问题,所以我专门抽时间做了一个基于C#的程序。
【目前的条形码扫描器有点类似外接键盘(其实从消息传送上它就相当于一个键盘),把输入焦点定位到可输入的控件上,一扫描相应的条形码信息就输入到文本框中去了,但是如果没有输入焦点,或另一个不相干的程序获得输入焦点,那就有点乱套了。
我想实现的是,不管什么情况,只要扫描器一工作,我的程序就能自动激活,并能获得当前输入的条形码信息。
实现思路:我用的是litele牌的USB口的红外条形码扫描器,仔细分析了一下,扫描成功后,以键盘按键消息的形式把条形码输入信息通知给系统。
这样通过键盘钩子就可以方便的获得该信息了。
但是,怎样区分信息是键盘还是条形码输入的哪?很简单,条形码扫描器在很短的时间内输入了至少3个字符以上信息,并且以“回车”作为结束字符,在这种思想指引下,很完美的实现了预定功能。
】窗体相关代码:view plaincopy to clipboardprint? .........10........20........30........40........50........60........70........80........90........100.......110.......120.......130.......140. (150)using System;using System.Collections.Generic;using ponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace ReadBadCode{public partial class frmTest : Form{BarCodeHook BarCode = new BarCodeHook();public frmTest(){InitializeComponent();BarCode.BarCodeEvent += new BarCodeHook.BarCodeDelegate(BarCode_BarCodeEvent);}private delegate void ShowInfoDelegate(BarCodeHook.BarCodes barCode);private void ShowInfo(BarCodeHook.BarCodes barCode){if (this.InvokeRequired){this.BeginInvoke(new ShowInfoDelegate(ShowInfo), new object[] { barCode });}else{textBox1.Text = barCode.KeyName;textBox2.Text = barCode.VirtKey.ToString();textBox3.Text = barCode.ScanCode.ToString();textBox4.Text = barCode.AscII.ToString();textBox5.Text = barCode.Chr.ToString();textBox6.Text = barCode.IsValid ? barCode.BarCode : "";}}void BarCode_BarCodeEvent(BarCodeHook.BarCodes barCode){ShowInfo(barCode);}private void frmTest_Load(object sender, EventArgs e){BarCode.Start();}private void frmTest_FormClosed(object sender, FormClosedEventArgs e){BarCode.Stop();}private void textBox6_TextChanged(object sender, EventArgs e){if (textBox6.Text.Length > 0){MessageBox.Show(textBox6.Text);}}}}BarCodeHook 类:view plaincopy to clipboardprint? .........10........20........30........40........50........60........70........80........90........100.......110.......120.......130.......140. (150)using System;using System.Collections.Generic;using System.Text;using System.Runtime.InteropServices;using System.Reflection;namespace ReadBadCode{public class BarCodeHook{public delegate void BarCodeDelegate(BarCodes barCode);public event BarCodeDelegate BarCodeEvent;public struct BarCodes{public int VirtKey; //虚拟码public int ScanCode; //扫描码public string KeyName; //键名public uint AscII; //AscIIpublic char Chr; //字符public string BarCode; //条码信息public bool IsValid; //条码是否有效public DateTime Time; //扫描时间}private struct EventMsg{public int message;public int paramL;public int paramH;public int Time;public int hwnd;}[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]private static extern int SetWindowsHookEx(int idHook, HookProc lpfn, IntPtr hInstance, int threadId);[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention =CallingConvention.StdCall)]private static extern bool UnhookWindowsHookEx(int idHook);[DllImport("user32.dll", CharSet = CharSet.Auto, CallingConvention = CallingConvention.StdCall)]private static extern int CallNextHookEx(int idHook, int nCode, Int32 wParam, IntPtr lParam);[DllImport("user32", EntryPoint = "GetKeyNameText")]private static extern int GetKeyNameText(int lParam, StringBuilder lpBuffer, int nSize);[DllImport("user32", EntryPoint = "GetKeyboardState")]private static extern int GetKeyboardState(byte[] pbKeyState);[DllImport("user32", EntryPoint = "ToAscii")]private static extern bool ToAscii(int VirtualKey, int ScanCode, byte[] lpKeyState, ref uint lpChar, int uFlags);delegate int HookProc(int nCode, Int32 wParam, IntPtr lParam);BarCodes barCode = new BarCodes();int hKeyboardHook = 0;string strBarCode = "";private int KeyboardHookProc(int nCode, Int32 wParam, IntPtr lParam){if (nCode == 0){EventMsg msg = (EventMsg)Marshal.PtrToStructure(lParam, typeof(EventMsg));if (wParam == 0x100) //WM_KEYDOWN = 0x100{barCode.VirtKey = msg.message & 0xff; //虚拟码barCode.ScanCode = msg.paramL & 0xff; //扫描码StringBuilder strKeyName = new StringBuilder(255);if (GetKeyNameText(barCode.ScanCode * 65536, strKeyName, 255) > 0){barCode.KeyName = strKeyName.ToString().Trim(new char[] { ' ', '\0' });}else{barCode.KeyName = "";}byte[] kbArray = new byte[256];uint uKey = 0;GetKeyboardState(kbArray);if (ToAscii(barCode.VirtKey, barCode.ScanCode, kbArray, ref uKey, 0)){barCode.AscII = uKey;barCode.Chr = Convert.ToChar(uKey);}if (DateTime.Now.Subtract(barCode.Time).TotalMilliseconds > 50){strBarCode = barCode.Chr.ToString();}else{if ((msg.message & 0xff) == 13 && strBarCode.Length > 3) //回车{barCode.BarCode = strBarCode;barCode.IsValid = true;}strBarCode += barCode.Chr.ToString();}barCode.Time = DateTime.Now;if (BarCodeEvent != null) BarCodeEvent(barCode); //触发事件barCode.IsValid = false;}}return CallNextHookEx(hKeyboardHook, nCode, wParam, lParam);}// 安装钩子public bool Start(){if (hKeyboardHook == 0){//WH_KEYBOARD_LL = 13hKeyboardHook = SetWindowsHookEx(13, new HookProc(KeyboardHookProc), Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetModules()[0]), 0);}return (hKeyboardHook != 0);}// 卸载钩子public bool Stop(){if (hKeyboardHook != 0){return UnhookWindowsHookEx(hKeyboardHook);}return true;}}}【注意】要想测试实际的效果,必须执行编译后的Exe文件,在开发环境直接运行会没有效果的。