Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

problems with rs-232

Solved!
Go to solution

A barcode scanner connected as a keyboard does not require the input device controls. Just like you would use a string control to ask a user to enter something from the keyboard, a string control is all you need for the scanner. Below is about the simplest method to read a scanner. If the scanner is set to append a CR at the end of the scan and if the Ok button's key navigation is set to toggle on the return key, it's all that you need. An event structure works just as well.

 

Read Barcode Scanner.PNG

 

 

0 Kudos
Message 11 of 17
(1,981 Views)

That's surely right. But what if the control isn't on the main VI front panel? How can I activate it?

 

My idea was to build a subVI like the one I used for the serial ports, but I found some problems in doing it (I've difficulties at reconstructing the string). I post the code, even if I know there are some mistakes (the use of the queues is just a trial).

 

Thanks!

0 Kudos
Message 12 of 17
(1,974 Views)
Why does the string control have to be on the main VI? Why not use a popup that actually tells the operator to actually perform the scan? You can probably get the device functions to work but it seems like Rube Golberg code to me.
0 Kudos
Message 13 of 17
(1,959 Views)

Ahah.. I got it.

 

I explain you my problem. If I put the string control in a subVI, how to activate the reading process? If I want to write on a control, I have to pass over it and click with the mouse in order to activate it. If I don't see it on the screen and I don' have a mouse, how can I write with the keyboard??

0 Kudos
Message 14 of 17
(1,955 Views)
Solution
Accepted by Stefano Moret

You would use a KeyFocus property. The attached VI is an old one that I've used. I now use an event structure and some validating to the bar code to make sure the correct one has been scanned but this one should get you started. The stop button can be hidden. the VI will stop as soon as the enter key is detected and you can program scanners to send that at the end. Because I made the VI a dialog, the front panel will popup whenever it is called.

Message Edited by Dennis Knutson on 07-23-2009 02:36 PM
0 Kudos
Message 15 of 17
(1,942 Views)

Thanks, you made me discover this function. Being totally new to this programming environment, I lost one afternoon on this and how I discover how easy it was! But I think it's normal.

 

Now I'll go on with my program, I've to make the three instruments send the data to the main program, which has to check and analyze them. Just one question about it: the analysis about the data (with a grenn/yellow/red display on the front panel) should be done in the sub-Vi or in the main after having taken them out of the queue?

 

Thanks a lot for your help! I'm really getting involved with this programming environment 🙂

0 Kudos
Message 16 of 17
(1,925 Views)

Using the key focus I still have 2 problems:

 

1. If I don't use a pop-up panel, the first time the program executes the controls aren't enabled;

2. How to get the string at the indicator?

 

tks

0 Kudos
Message 17 of 17
(1,912 Views)