04-06-2009 01:34 AM
I am currently trying to utilize a barcode scanner that is connected via a ps2 port. It works similarly to a keyboard.
However, i have a problem taking signals from a ps2 port, as i do not know any function that could do that in LabVIEW.
Please advice.
Thanks a lot guys.
Cheers,
Justin
Solved! Go to Solution.
04-06-2009 02:16 AM
Open LabVIEW and navigate to Help >> Find Examples. Then search for "parallel", and you will find two examples: Parallel Port Read and Write Loop.vi and Parallel Port Additional Data Register Inputs.vi.
Try that and see if it works for you.
04-06-2009 02:31 AM
Easy way : A String Control , however the control need the focus
More sophisticated: the keyboard vis located at connectivity-input devices
How to know was this a keyboard or a scanner input ???
Most scanner can be configured to send some pre- and post-codes (liker termination characters). So you 'only' have to configure your scanner and write an filter that catch the scanner inputs.
It is good practice to filter and PROOF the input, since most scanners accept a lot of codes, so (like always) you have to expect the worst.
If this string goes to a database : code injection via barcode strings is a proofed concept
04-06-2009 02:46 AM
Dear Adnan,
Thanks for your advice. However, i am not sure if a PS2 port can be read in similar fashion as the Parallel port as mentioned. Are they both the same?
Please advice. And thanks again for the suggestions.
Cheers,
Justin
04-06-2009 02:56 AM
You have functions to read the keyboard in the functions pallette. navigate to connectivity>>input device control and here you will find the vi's specific to key board. But how does the system distinguish between barcode reader in PS/2 and keyboard. Does they both use same protocol for data transmission.
Give a try and post back for queries.
04-06-2009 03:55 AM
Dear Henrik,
Do you know of any keyboard emulators around? Btw, is there any software that can help configure the scanner pre- and post- codes? Atm, i know that the scanner has a default "/n" or "enter" post code, that can be helpful.
Please advice.
Thanks for your kind assistance and your time.
Cheers,
Justin
04-06-2009 04:14 AM
Hey there JK1,
Thanks for your input.
Anyway, do you know of any methods of how to utlize the "prompt user for input" dialog function to close with the "enter" key. This is because, the scanner works like this:
*scan*
the barcode is to be scanned is numbered 12345678
*beep*
the scanner will emulate the keystoke of a keyboard "12345678(followed by the enter key)" or "012345678/n"
*in a text doc* -> it will if you scan 2 barcodes in sequence tagID is 111 and 112 respectively
111
112
(take note that there is an line spacing which emulates the "enter" key at the end of the scan; the default config of the scanner)
thus, if i use the the dialog function, i would require the use of the mouse or an additional keystroke "tab" inbetween the scanned numbers and the "enter" or "/n" to close the dialog box.
Is there any way to automate this "prompt user input" dialog to close automatically given the scanner ends with the "enter" key?
Thanks for the advice.
Cheers,
Justin
04-06-2009 05:09 AM - edited 04-06-2009 05:10 AM
quick shot , add a manual cancel function, appearance, dialog option, ...
