LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB Barcode Event

My programs are heavily dependent on Event Structures. Once you start using them though, they are hard to get away from. The User's Test Interface is essentially tabbed panels with buttons on them for launching some activity, so event structures work well. I have some event structures with state machines inside for completing various tasks, etc.

Now I want to add a USB barcode reader to input the serial number of the UUT during test. The desired scenario will be something like:

1) Test Stand has USB barcode reader installed and positioned to read the label on an installed UUT
2) Operator installs a serialized label on UUT
3) Operator installs UUT on test stand
4) Operator presses Test button

Then, within the state machine for testing, I would scan the serial number first, a successful scan being required to continue the test.

Can a USB barcode scanner be implemented in this fashion, that is, be told to "Read" at a certain time, or does it Read all of the time as soon as a label is flashed in front of it? Is there a way to prod it to read at a specified time?

We are looking at the Symbol MS-4407-1000R barcode reader.

Thanks,




~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 1 of 23
(9,114 Views)
Hello Paul,

I'm not familiar with that exact barcode reader, and I couldn't find anything online about it.  Still, it's probably similar to many scanners I've used in the past so I'll try.

Some readers will read all the time.  Some you can control via VISA commands.  Check your scanner manual for this. 

In my experience, most scanners are set to read all the time by default.  We try to leave these kinds of peripherals default if we can because it makes things much easier for our customer's maintenance department when things are replace.

For a scanner the scans automatically, I just put use a VISA read and read all the "bytes at port" in a quick loop and end the loop when I read zero bytes.  I do this to ensure that the "buffer" is clear and that when I make my "good" read, I'll know it's the part currently sitting in front of the reader.  



Good luck.


Message Edited by pallen on 04-02-2008 02:16 PM
---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 2 of 23
(9,094 Views)

For USB scanners, most emulate a keyboard and VISA will not work. It's only serial scanners that can use VISA. For USB scanners, you just need a string control for data entry.

I did find a product manual and it appears that by default, it scans when something is nearby or you can optionally send it a trigger.

0 Kudos
Message 3 of 23
(9,088 Views)
Thanks Dennis,

Do you have any examples of how this would be triggered? How is the USB scanner triggered from within LabVIEW, and how is the emulated key board tied to the string control?

Thanks.
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 4 of 23
(9,077 Views)

I don't know the trigger mechanism for this scanner. It should be in your manual.

A USB scanner that emulates a keyboard is indistinguishable from the normal keyboard. There is nothing to tie a string control to it. It's not any different from a string control where you expect someone to manually type something in. For an event structure, you can use a value change event. With a lot of scanners, you can also program them to append a character (i.e. CR/LF) and have a front panel 'OK' button mapped (Key Navigation) to that. Long before there was an event structure, a simple while loop would work this way.

0 Kudos
Message 5 of 23
(9,069 Views)
I'm experimenting with code for this Bar Code Reader application and I hate re-inventing the wheel. I seem to need the UpdateWhileTyping property node set true to make things happen. I notice that this tends to slow the data entry to typing speed, not sure of that's a problem or not, I just noticed it.

I want the program to scoop the serial number out of the control and not have the operator need to "check" off the value. Is there a better way to do this?

What I want is for the program to be "waiting" for appropriate serial number data and then acting on it. In this example I equated appropriate to 12 characters.

Any suggestions out there?
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 6 of 23
(8,979 Views)
Hi Paul,
 
I'm a bit unclear about that last post.  Does "appropriate serial number" mean appropriate based on the number of digits or appropriate as in the serial number is in a list (therefore exists in a database or array or sorts)?
 
Can you expand on what you'd like to do?
0 Kudos
Message 7 of 23
(8,943 Views)
Hello Tolga,

I've made some progress, see attached VI. This VI represents my Main VI in that it uses an Event structure and a tab control, both of which are key essentials in my existing main porgram. Things that I want to do with bar code read of serial numbers in my main program include:

Enable or disable the requirement for serial numbers
Enable or disable the Test buttom based on valid serial number or whether or not a serial number is required

These issues I seem to have addressed, but...

The main issues I'm having are centered around the fact that the reader is easiest to employ as a USB keyboard emulator. There may be programtic methods of controlling the device, but I'm hesitant to delve into that at this time if I can make the emulator method work satisfactorily.

As a keyboard emulator though, there are some drawbacks.

1) A string Control requires the Key Focus in order for the code to be input to it. Therefore, I have to programatically give the string control the focus, this has ramifications.

2) Since I need the focus in the control string, I'm having trouble getting to other pages of the Tab control. See attached VI which so far fails to do this.

3) Any input feature on the panel may react to the act of "reading" if that feature has the Key Focus. Similar to pressing the Space Bar or  Enter button on the keyboard. So, if my "Test" button has the focus, and someone places a readable serial number in front of the reader and it beeps, its tantamount to pressing the Test button. That's a bummer 😞

4) Giiven item 3) above, its ironic that the beep on the reader isn't suffcient impetus to complete the string control input, the only way I have found around this is to enable the UpadateWhileTyping propoerty of the string control. If I don't enable this, the string size is zero in the loop of the attached VI.

Any advice would be appreciated. Kind of a long post. I may end up having to the control the reader as I would a serial device. Not sure how to do that, but a previous post in this thread may help there.





3) I haven't come up with a way to tell what's in the input control string without enabling UpdateWhileTyping.


~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 8 of 23
(8,912 Views)
Hello Pallen,

Well, I've about exhuasted the keyboard simulator use of the bar code reader, too many downsides as can be seen by my last post.

I've decideded to proceed with using the reader as a serial port device thinking it will be more controllable. I'm trying to impliment your scheme, see attached jpeg.

I've configured the reader as "Simple COM Port Emulation" and verified that Windows installed the device on COM 2, but no luck geting the read buffer string indicator to show anything yet.

Have I interpreted your scheme correctly? Doesn't the loop as shown just fill the read buffer string control with 0 bytes everytime around?



Message Edited by Pablop on 04-28-2008 11:37 AM
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 9 of 23
(8,880 Views)

Hi Paul,

It looks like your VI will onlt exit the while loop if the string length is=0, therefore if it ends, there was no data to display.  Also, you do not show how you are triggering the scanner.

Jim

LV 2020
0 Kudos
Message 10 of 23
(8,861 Views)