LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB HID to ASCII conversion (Barcode Scanner)

Hello,

 

After doing some research on reading a USB HID barcode scanner in Labview, I came across the previously posted (USB HID Interrupt) example which works perfectly with interrupt enabled HID devices, however the output array is an 8 byte array where the 0th byte is the special character and the 3rd byte (index 2) is the needed data following the given standard 

http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf

 

I tried searching for a ready VI to do the conversion for fast and testing purposes but could not find any so I decided to make a small program for data conversion.

 

The following project is a simple draft project for testing purposes where it reads the buffered data from the interrupt pipe and converts it to its relevant ASCII string. the array constant does not cover all USB functions but later on I will update the program to follow a decent state machine/event based architecture with proper look up table and conversion.

 

feel free to include your own modifications

Thank you

Certified Labview Developer
0 Kudos
Message 1 of 5
(6,280 Views)

Every single barcode scanner I have used appears to the system (and to LabVIEW) as a USB keyboard.

 

So scanning in a barcode is no different than typing it in on a keyboard. I popup a dialog telling the end user to scan the barcode and wait for the proper amount of characters to be entered in a string control.

 

They can scan it or type it in.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 5
(6,253 Views)

Hello,

 

Yes that is correct it is compatible in almost anything, but the point in keyboard mode is that you have to keep a string control focused or any input selected for it to acquire data and write it where you might experience trouble switching windows or having unwanted pop ups appear. The purpose of this example is to acquire data on interrupt (whenever data is present) even if the program is running in the background

Certified Labview Developer
0 Kudos
Message 3 of 5
(6,247 Views)

@ghattas.ak wrote:

Hello,

 

Yes that is correct it is compatible in almost anything, but the point in keyboard mode is that you have to keep a string control focused or any input selected for it to acquire data and write it where you might experience trouble switching windows or having unwanted pop ups appear. The purpose of this example is to acquire data on interrupt (whenever data is present) even if the program is running in the background


I guess that makes sense, it depends on the application, ours is automated test on the assembly line. The tech's are scanning in the serial numbers of products being tested. The computers in the ATE really only run the one program (our IS department did some "magic" to limit what programs the end user can run) so switching windows and unwanted popups is not an issue.

 

Also we have found that some labels just can not be scanned so there has to be a manual entry option.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 4 of 5
(6,243 Views)

Yes, that is a problem with the running services, I am trying to create an attendance system based on barcode scanning but I am re evaluating my pick as the barcode scan requires the serial to be scanned or entered manually at some points, where that can be maintained on equipment it is somehow hard to manage on people so I am checking the NFC readers that can scan available tags in a room and log the In and Out times.

Certified Labview Developer
0 Kudos
Message 5 of 5
(6,232 Views)