01-15-2016 05:45 PM
Hello All:
I have an issue with a bar code scanner, specifically Unitech AS-10U.
Now my problem is this, I'm trying to create a sub.vi that takes the input from a bar code scanner as if its input from the keyboard, verify that the information is the right length and move on to the next step in the sequence. When I use "Bar Code Scanner.vi" (see attached vi) as a standalone vi it works fine no problem, however when I embed this sub.vi into my main.vi it stops working (even if I paste the entire contents of the sub.vi into the main.vi). I have found that using the "Highlight Execution" button in the block diagram and probing the input string magically makes it show up, however without doing this the input string remains blank (this works in all cases).
So I tried hitting the forums and I came accross "Prompt User for Input" and it worked beautifully, only down side was that now I have to click the okay button to get it to accept the Serial Number I'm trying to input, so I modified it to measure the length of the string and use that as the acceptence criteria for terminating the while loop (see attached vi). Then bam same problem, now it wont work unless I probe it.
Can someone help me and tell me what I'm doing wrong, I've tried looking on the forums and havent been able to find someone who had the same issue I did.
Thanks for taking the time to read my post, I appreciate it.
Solved! Go to Solution.
01-15-2016 06:52 PM
remove your "reinit to default, they are useless. it should fix your problem.
01-18-2016 11:01 AM - edited 01-18-2016 11:03 AM
Thanks 1abvi3w for the reply I tried what you suggested and it didn't work.
I still have the same problem unless I move away from the front panel by either going into the block diagram or probing something nothing shows up, and if I have my probes set up before I click run, then the outputs show up as blank until I move away from the front panel.
01-18-2016 02:07 PM
Throggdor,
Can you give us more information about how you are calling the sub vi Barcode Scanner? For example, do you have the sub vi in a loop?
Also, did you remove all instances of "reint to default"?
01-18-2016 02:40 PM
I'll add that you don't need those flat sequence structures so remove the entire thing. You also do not need the While Loop, either. Get rid of it.
01-18-2016 03:27 PM
That will solve most of the trouble, Then STOP Polling! use a Value Change Event and exit if the string length is 6-9 characters long. (Disable wrapping too).
01-19-2016 03:41 PM
Thanks everyone for your help, I made the changes suggested by Jeff, and it works beautifully now. Thanks a bunch.
01-20-2016 07:53 AM - edited 01-20-2016 08:08 AM
@Throggdor wrote:
Thanks everyone for your help, I made the changes suggested by Jeff, and it works beautifully now. Thanks a bunch.
Happy to have been of help.
For completness for others. Most bar code scanners read the code and add a "Return" to the end. just as if someone typed the data from the bar code and hit return. The "Return" triggers a value update(AKA Value Changed) IF the "limit to single line flag" is set on a string control
By taking advantage of the Value Change Event triggered by the scanner's added "Return" a lot of CPU usage can be freed up from the code and, it works with much less effort on the LabVIEW Coder's part.
Some of those "Unique" string control properties, like "Limit to single Line" and "Update value while typing" are fairly intuitive in English- I don't know about other languages- HOWEVER, you have to know they exist to use them!
Kudos to anyone that finds a shipping example that showcases String Control Behaviors.
01-20-2016 10:59 AM
On top of Jeff's response, getting rid of the sequence structures and the While Loop will help your code too and not confuse the next person that comes along & has to "read your code."