LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Bar Code won't scan in

I want to scan in an alphanumeric string from a bar code scanner(code 39). When I run the scanner across a test code the test code appears in the correct area but then dissapears. If I hit the enter key while scanning some of the text my stay.
0 Kudos
Message 1 of 10
(5,605 Views)
Are you using a wedge type reader that goes inline with your keyboard. If yes, then I assume that you have a string control that has focus? Or are you using some sort of keyboard handler? From the information provided I would guess that you have your control in a loop and you are unknowingly clearing it in each loop cycle.

If this is not correct then please fill us in with more information.

Brian
0 Kudos
Message 2 of 10
(5,605 Views)
This may not directly answer your question but try one of these few things:

1. Try scanning the test code into Notepad and verify that it is reading the correct characters.

2. When I used a barcode scanner with LabVIEW, I used a string control that gets focused when called. I checked "Limit to single line" for the string control so when your barcode scanner reads the last character, the string control loses its key focus.
0 Kudos
Message 3 of 10
(5,605 Views)
Now this sounds familiar. After the barcode has been read in, try clicking on the input control and then back up a few characters (left arrow or delete - whichever). Does the scanned number reappear? If so, then the barcode scanner is adding a carriage return after scanning.
Right click on the control and "Limit ot Single Line". This should solve that problem. If you are processing the data, just be aware that the carriage return (and possibly line feed) characters are in the string.

Hope this helps.

Rob
Message 4 of 10
(5,607 Views)
Hello Rob,
 
I ran into the same issue with my scanner and was looking for help from the NI forum, and I was lucky to found your post.  The only problem I have now after changing the string control to "Limit to Single Line" is that sometimes it will take 2-3 attempts for the scanned barcode to be recognized.  When it is not recognized, the barcode disappeared immediately once it is scanned.  BTW, I am using a Welch Allyn IT3800 scanner.    What is causing this and what can I do about it?  Your advice is really appreciated.
 
Valen
Message 5 of 10
(5,376 Views)

Hi Valen,

I have worked with the Welch Allyn IT3800 scanner.  Very nice product. 

When you say: "sometimes it will take 2-3 attempts for the scanned barcode to be recognized."  Do yiou mean the actual scanning of the barcode itself?  Or do you mean the vi getting the barcode information?

The reason I am asking is because of this statement: "When it is not recognized, the barcode disappeared immediately once it is scanned. "  The barcode meaning the information, right?  The barcode itself doesn't dissappear...  right 😉

I saw this problem in my early days with the scanner(s).  From what I can recall, it turned out that the carriage return was overwriting the string before it was processed.  THis was a wedge-type scanner which ended with a "\n\r".  The cause was that I placed the barcode scan reading in a while loop, waiting for a string to appear.  The string appeared, followed by a carriage return.  Unfortunately, the while loop intercepted the string and processed another iteration of the loop before stopping.  By that time, the string contained a carriage return which had a non-zero length.  And the string that was passed to processing appeared to an empty string constant (until I noticed the \n\r..... )

If you are reading the barcode information within a loop, try Highliting the Execution (lightbulb) and look at what happens to the string.  You can also place a Probe Data to look at the value of the barcode info..  and see if it does capture the information from the barcode.

The above description may not be your issue, but who knows..  😉 

JLV

Message 6 of 10
(5,361 Views)

Hello Joe,

Ooops....Sorry about the confusionSmiley Tongue

I use the while loop and key focus to read the data until the string length meets or exceeeds the spec, 18 bytes, assuming possible termination characters.  The barcode information read into string control disappears immediately, and the probe shows the string is empty and the length is 0 when this happens.  When the string is in '\' Codes Display, I don't seem to see any \n\r. 

If the VI is continuously run, the data is hardly captured; if it is single runs, sometimes it passes with only one run and sometimes it takes 2-3 attempts.  Since I am using LV5.1.1 for this to be compatible with the legacy systems and event structure is not available.  I have changed the loop time delay from 10mS to 1000mS, and it seems to be working 100% now.  I am a beginner with scanners and I am not sure how additional time delay helps....your comments?

Thanks,

Valen

 

 

0 Kudos
Message 7 of 10
(5,345 Views)

Hi Valen,

It does look like you're having a similar problem to what I was having....  I was using LV6.0 at the time. 

Basically, when the while loop is executing, you are trigerring on the fact that there is an appropriately long string available to be processed, but by the time it is ready to be processed, the info is gone.   My work around (if I recall..) was to place a shift register and append whatever string was captured and feed it to the shift register.  The output of the shift register was then passed to the next step for processing.  Otherwise, the string was always "dissappearing".  I think it was because it was processing the value in the next iteration, whuich means that the barcode data got captured, the while loop does an iteration, then sees the data, but since it was in another iteration, the scanner was read again and filled the string with its new value which was an empty string (it had not read something new). Then this new value was passed from the while loop.

I know, the above doesn't make sense.... how do I describe that better....  Hummm....  the best way is to probe the data while highliting the execution, you'll see what happens.

Remember, you are reading the device at all times. like the keyboard, for instance... if you don;t type anything, nothing appears on the screen.  But it doesn't mean that the keyboard buffer is not being read..  So in the while loop, you are reading (looking at the value) of the string for every iteration, whether there is data or not.  So, once you actually trigger on the fact that there is data, the data is now flowing and the string "buffer" is filled with whatever the scanner now scanned, which is typically nothing.  So that becomes the new data... or at least in the scenario that I had when first playing with scanners. 

Appaending all new data permitted the loop to conserve past data which included what was recently scanned.  I then parsed the data before processing it. 

For what I was experiencing, the idea was that either I kept the last barcode capture or processed the data within the same iteration of the while loop.  It's been a while since I worked with barcode scanners, but the last time I programmed a vi for it, I basically place a delay greater (slightly) than the time for the scanner to process the scan and append whatever is captured onto a single string which is parsed before processing.  Worked great with the wedge types..

Sorry the explanation is strange...  I probably have need for more cafeine!!  😉

Hope it does help you.  But from what you describe, it sounds very familiar..  😮

😄

JLV 

Message Edited by JoeLabView on 04-19-2006 02:03 PM

Message 8 of 10
(5,334 Views)

Hello Joe,

I see what you are trying to explain and it is clear enough for me.  Thank you so much for all the details and your help.

 

Have a blessed day,

Valen

Message 9 of 10
(5,299 Views)

Hi Valen,

You are welcomed.  Let me know if it works ok and/or if you need further help.

JLV

Message 10 of 10
(5,293 Views)