03-29-2010 02:34 PM
Hi guys, I have several string inputs on the front panel, which each should take an input from a barcode scanner.
What I want to do the VI to achieve is, jump to the next available string input, once one of the string input receives an input from the barcode scanner. (as shown in the transition from picture 1 to pic 2.)
Is this possible?
Cheers!
Picture 1
Picture 2
Solved! Go to Solution.
03-29-2010 02:47 PM
03-30-2010 08:58 AM
One thing to watch out for is to check to see if the scanner appends a linefeed or other similar character to the string - you will likely need to strip this out.
Also, if the scanner is connected via a keyboard wedge, then as far as the LabVIEW VI is concerned, the characters would be coming in as if they were being typed in via the keyboard. That means that in order to see a value change event you will need to set the properties of the string control to "update value while typing". You can do this by right-clicking on the string control. This means that the event will be triggered for each character typed. Thus, you will need to determine when you've got the full code. Obviously, you will need to handle incomplete scans.
If, on the other hand, the scanner is connected via a serial port, then you would know that you've received the full code once you see the termination character on the serial port.
03-30-2010 09:44 AM
Unofficial Forum Rules and Guidelines
Get going with G! - LabVIEW Wiki.
17 Part Blog on Automotive CAN bus. - Hooovahh - LabVIEW Overlord
03-30-2010 02:31 PM
Thanks guys for your feed back !
to Smercurio: thanks, this is useful as my barcode scanner plugs into a serial port
to Hooovahh: what a shame I saw your post after I have implemented my VI using Mark's feed back, doing it your way would certainly have made it easier than what I have done.
Although the VI is working now, there is still one thing I am curioused about:
I have set the VI to set focus on the first string input when it starts. Now, this would work only if I run the VI from the front panel.
If I run from the block diagram, the VI doesnt set focus on the first string input.
This is only for my curiousity, but does any one know why this is so?
Cheers!
03-30-2010 03:10 PM
jack@nz wrote:
I have set the VI to set focus on the first string input when it starts. Now, this would work only if I run the VI from the front panel.
If I run from the block diagram, the VI doesnt set focus on the first string input.
This is only for my curiousity, but does any one know why this is so?
Cheers!
I just verified that. Running by clicking the run arrow on the block diagram makes the block diagram window come to the foreground. Therefore, the focus means nothing because it is done on a window that is in the background. If you click on the front panel and bring it to the foreground, the focus is NOT on the first string. I would guess that the front panel string focus property was overwritten when the block diagram became in focus. So the string focus is lost.
Lesson: Use the run arrow on the front panel to run VIs involving setting focus on some front panel object.