LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Re: Is it possible to directly read a barcode into Labview?


@pincpanter wrote:

There are barcode readers emulating a serial port over USB. The LabVIEW code could poll the port and drive any input to the proper wire.


Anyone ever tried that? It might work, but usually the barcode scanners are also seen as keyboard. So how to disable the automatic keyboard feature?

0 Kudos
Message 11 of 26
(2,473 Views)

wiebe@CARYA wrote:

@pincpanter wrote:

There are barcode readers emulating a serial port over USB. The LabVIEW code could poll the port and drive any input to the proper wire.


Anyone ever tried that? It might work, but usually the barcode scanners are also seen as keyboard. So how to disable the automatic keyboard feature?


I've only ever used the scanners that act as a keyboard wedge but my understanding is that there are scanners which are RS232 or RS232 over USB which just act as a standard serial device and Windows would not treat them as a second keyboard.

 

http://www.taltech.com/barcodesoftware/articles/which_barcode_scanner_interface

Matt J | National Instruments | CLA
0 Kudos
Message 12 of 26
(2,465 Views)

wiebe@CARYA wrote:

@pincpanter wrote:

There are barcode readers emulating a serial port over USB. The LabVIEW code could poll the port and drive any input to the proper wire.


Anyone ever tried that? It might work, but usually the barcode scanners are also seen as keyboard. So how to disable the automatic keyboard feature?


Been there done that. May have been a "MicroScan" device? Not sure. so many widgets over the years so few brain cells left.

 

Aside from a command to tell it to start reading I just had to read the serial buffer and ... well you know the rest of the story.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 13 of 26
(2,456 Views)

We don't know which is the scanner model used by sudhin_sudh, but it's possible that it could be configured as a USB or Serial-over-USB device in addition to kb wedge.

I used in the past some Datalogic scanners that featured multi-I/F. There are even BT interfaced models.

In any case, it's the only hope for the OP to get the scanned data in an unattended way.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 14 of 26
(2,446 Views)

Guess it is possible to block a keyboard, and read it's raw stream:

https://stackoverflow.com/questions/34880401/standard-way-to-read-data-from-usb-bar-code-devices-c-s...

 

https://www.codeproject.com/Articles/716591/Combining-Raw-Input-and-keyboard-Hook-to-selective

 

I'd think buying a scanner suitable for the purpose makes more sense... What I get from the web is most scanners can be configured to act as either a keyboard, or a serial device...

Message 15 of 26
(2,443 Views)

Of course, if we look into the example finder.....

 

We get this

Capture.png


"Should be" isn't "Is" -Jay
0 Kudos
Message 16 of 26
(2,435 Views)

Here's a whole mess of RS-232 interface barcode scanners.

 

http://www.retailerwarehouse.com/Barcode-Scanner-World-RS-232-Serial-Barcode-Scanner-s/162.htm

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 17 of 26
(2,430 Views)

Oh, my goodness.  It is so simple to use a USB Barcode Reader ("scanner").  It takes three VISA Commands -- Open VISA, VISA Read, and Close VISA.  If you want to read multiple items, put the VISA Read in a While Loop.

 

Note that you do need to know some of the properties of your Barcode device, such as its Baud Rate and something about the data stream that it generates.  We have one that we use to read a 9-character bar code that identifies a container.  The same code and scanner also is used to read a QR symbol that gives us the 6-character part number.  This particular scanner uses ^D (hex 04) as the "End-of-stream" character, so we build that into the Open VISA function.

 

Bob Schor

0 Kudos
Message 18 of 26
(2,418 Views)

@Bob_Schor wrote:

Oh, my goodness.  It is so simple to use a USB Barcode Reader ("scanner").  It takes three VISA Commands -- Open VISA, VISA Read, and Close VISA.  If you want to read multiple items, put the VISA Read in a While Loop.

 

 


Sure if the barcode scanner in question installs as a virtual com port.

 

The OP's scanner and all of the barcode scanners we have here are USB but they all appear to Windows (and LabVIEW) as a USB keyboard, not as a virtual com port.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 19 of 26
(2,413 Views)

Jeff·Þ·Bohrer ha scritto:

Of course, if we look into the example finder.....

 

We get this

Capture.png


Yes I knew about these functions, although I never used it before doing a little experiment.

First, acquiring the keyboard doesn't return a history of the keystrokes, but which keys are currently pressed. For example, sampling at 1 ms and typing 'ciao' I got a sequence like ccccccccccciiiiiiiiiiaaaaaaaaooooooo. The number of repetitions of each key was different, depending on the time lapse my fingers remained on the keys (although we may expect the reader would be more regular).

Second, the OP says that the operator will be working on something else, possibly pressing further keys. The Initialize keyboard vi does not seem to be able to discriminate between the two devices.

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 20 of 26
(2,402 Views)