LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

USB Barcode Event

The scanner is always reading, I can hear it beep when I place a label in front of it, even though it definetly no longer emulates a keyboard.

I realize there is something not right about the loop, I was wondering how pallen intended its use.

I'll just fudge around and see if I can come up with my own method.
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 11 of 23
(2,856 Views)
Hi Jim,

Yes, I just implemented it as I saw pallen's example, didn't understand how he inteded its use.

I've revised it to the state shown. Works much better now. I've got a starting point for building up the program, should work fine.

Thanks again.
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 12 of 23
(2,853 Views)
Would a key-down event (in keyboard emulation mode) on a front panel do the trick?

Ton
Free Code Capture Tool! Version 2.1.3 with comments, web-upload, back-save and snippets!
Nederlandse LabVIEW user groep www.lvug.nl
My LabVIEW Ideas

LabVIEW, programming like it should be!
0 Kudos
Message 13 of 23
(2,850 Views)

I just implemented a bar code reader that read data over the serial port.  I triggered my program using VISA events (see attached).

There is also a USB interupt event that you can chooser from.  Don't know if that would work for your application.

Dan



Message Edited by ASTDan on 04-28-2008 03:26 PM

Message Edited by ASTDan on 04-28-2008 03:28 PM

Dan Shangraw, P.E.


   

0 Kudos
Message 14 of 23
(2,847 Views)
Hi Ton,

Ive moved on do to other problems using keyboard emulation, such as the fact that the system does infact have a keyboard as well!

I'm also very dependent on Events in my main program and I've heard that mouse and keyboard events can introduce instability, I'd hate for that to happen. I'm kind of a plin jane event guy, it has to be value change for me to use it.

The serial port method looks like its going to work out fine. I can have a While Loop running outside the event structure that handles it well.

Interesting note to other would-be-event structure users. You haev to wire a constant to the Event Structure Timeout terminal in order for loops outside the structure to be executed. Otherwise, with the default (-1), these outside loops never execute.


~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 15 of 23
(2,845 Views)
Hi Dan,

Nice code, but how does it work? When I run it, there's no loop or event structure, so it just finishes.

Is it supposed to wait at the Visa Wait on Event VI?

I can't get anything into the read buffer string indicator. 😞
~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 16 of 23
(2,842 Views)
Hi Dan,

OK, I put sometime in on the Timeout terminal so it would wait. Now I can read it in.

Interesting technique. I'll have to work with it a bit. I wonder how other loops are affected while waiting for this event?


~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 17 of 23
(2,838 Views)

The magic is you can put the "Wait for event" in another loop.

When that fires you can send the data to another loop using a queue or user event.

Dan



Message Edited by ASTDan on 04-28-2008 03:54 PM

Dan Shangraw, P.E.


   

0 Kudos
Message 18 of 23
(2,835 Views)
I agree with TonP,

It is quite easy to work with a scanner using the key down event. As the data probably comes from the scanner in a burst or many chars in a second, its painless to use the event structure to buffer the incoming chars, and then periodically check your received string for something you would typically expect from the scanner (i.e. a certain length of data, and then if this length is reached you can search the string for tokens you expect in it). This only requires the main VI front panel to have focus, not an individual string control.

I am not sure where you heard that using keyboard and mouse events can cause stability problems? This is certainly news to me.
0 Kudos
Message 19 of 23
(2,807 Views)
OK,

Sounsd good, I'll investigate the keydown Event. I love event structures.

I can't find the thread I was thinking about RE: mouse event, but maybe its a bad rumor and I should forget it!


~~~~~~~~~~~~~~~~~~~~
Paul Johnson
Renco Encoders, Inc
Goleta, CA
~~~~~~~~~~~~~~~~~~~~
0 Kudos
Message 20 of 23
(2,803 Views)