LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to read multiple scanner entries?

I want to write a simple VI that allows an operator to read either 1 OR more barcodes using a scanner.

The operator should not have to press enter or click on the next box, etc. to read more than one barcode.

 

I imagine the VI to have a combo box with different operator names. The operator would simply choose his/her name, 

then supposing he has several UNTESTED widgets with different barcodes, he would be able to scan, scan, scan, etc., and everytime

he scans, the barcode reading is entered into an array one element at a time. If any of the barcodes has already been entered,

the VI would pop up a warning that says the barcode has already been entered by another operator.

 

Another functionality of the VI should be to have another box to read barcodes of the TESTED widgets. The operator would be able

to scan 1 or more barcodes of the tested widgets. For a concrete example, imagine you have 5 widgets with barcodes A, B, C, D, E.

Pretend A, B have been tested and C, D, E are to be entered.

 

Is it possible to have this VI be in a "continuously running" state? In case you are wondering what the ultimate goal is, here it is:

Widgets come to our lab, get tested, and engineers want to know the test status of the widgets. I imagine a simple tracking system

that keeps track of all these widgets coming to the lab (they would get logged in), when the operator tests them, they will scan the widget

again with the status = TESTED, and when the engineers come to the lab, they can simply look up the barcode, and see the status of their widget.

 

 

 

0 Kudos
Message 1 of 8
(4,108 Views)

Of course you can do this.

 

The first question is how does the scanner operate?  Does it communicate by way of a serial port?  Or does it act like a keyboard wedge?

 

Your code will probably behave like an event driven architecture.  When an event occurs (data from scanner through the serial port), an event structure will execute, and it will update a set of data that is maintained on a shift register wire.  Exactly what it does to that data will be based on the data that comes into the serial port.

 

I imagine you will want to permanently store this data to a file (rather than relying on computer RAM) in which case you will want the data written to a file, or perhaps update a database file.

 

Start by writing out a flow chart of how the program should behave.

0 Kudos
Message 2 of 8
(4,103 Views)

Thanks. 

 

For the time being, the operator should have the ability to type in the barcode (they are pretty short).

But later, the barcode will be read by a scanner that is connected to the computer via as USB cable.

When I open up Excel, or even notepad, I can read and see the barcode using my USB connected barcode scanner.

I guess for Labview VI, I have to tell it which USB port to read? 

 

Yes, I have written down a flow chart, and everytime the untested widget barcode is read, it is saved in a file. Then later, when the 

widget is scanned after testing, this file will have to be updated, or maybe I will create another file with barcode and test status, and

combine the data from the two files and show them on the front panel. Attached is my first attempt at this.

 

0 Kudos
Message 3 of 8
(4,100 Views)

Several problems.

 

1.  Your loop is going to run as fast as it possibly again constantly putting the data of the controls into the spreadsheet text file.  You have no timing information on that loop.

2.  You have no event structure.  It is going to do this over and over.  You want it to only happen when you make changes or load a new piece of data into the controls.

3.  What is the second Write to Spreadsheet file function supposed to do?

0 Kudos
Message 4 of 8
(4,088 Views)

Thansk for those suggestions.


Attached is the modified VI. As I am going through your suggestions, I am getting more ideas about how I want the end product to look like.

 

The String Control that reads the EA (ENTER EA) should always have a blinking cursor in it by default and it should show empty.

The operator should be able to choose Machine, EA owner, EA test priority, then take the scanner, scan the barcode, and as soon as the barcode

is scanned, the VI should show the barcode in the ENTER EA String Control box momentarily, combine it with other selections, put all the data into an array,

write the array to file, then clear out the ENTER EA String Control and should wait for the next EA to be entered with possibly other changes to priority, operator, etc.

 

Hopefully, I am getting close to this with the attached VI.

 

Thanks again for your help!

 

 

0 Kudos
Message 5 of 8
(4,084 Views)

Your use of the event structure looks good. Although you probably want to create an event case for Value change on the stop button.  Otherwise your VI will only stop when you hit the stop button, then do one more value change on the string.

 

You have a possible race condition.  You read the string while in parallel reinitializing to its default value.  If the Reinit occurs first, then you are going to wind up reading and empty string.  Get rid of the reinit.  Use a local variable to write an empty string to the control, and set your wires (or even a sequence structure if necessary) to make sure the local variable gets written to AFTER the string control terminal is read.

 

Why do you still have the Read from Spreadsheet File in there right after writing?  You aren't ever actually doing anything with any data.

0 Kudos
Message 6 of 8
(4,077 Views)

Hi again,

 

I did a bunch of reading on Event-Structure programming using the User Manual from NI's website. It is useful, but didn't really

address my immediate problem at hand. 

 

The scanner that I am using reads the barcode and enters a new line. I verified this by simply scanner multilple barcodes in Notepad, and each time,

a new line started automatically. 

 

Question is how can I modify my VI to do the same. Ideally, the user wouldn't have to click on the string control at all. The VI will always put the cursor in the string control box, and the user would scan, the VI would read the value, save it, and put the string control box back in the "ready to read again" state. This should not be that difficult. I tried to fiddle with the invode property nodes, and couldn't succeed. 

0 Kudos
Message 7 of 8
(4,067 Views)

The way you are describing it, it sounds like it is behaving like a keyboard wedge.  That is a question I asked much earlier.

 

You might be able be able to use Key events in the event structure.  But I think your application would be more robust if you were able to set the scanner up to act like a serial device that you can use VISA to communicate with.

 

Search the forums for scanners.  Interacting with them has come up many times before, and I think you'll find ideas there on how to make your application work.

0 Kudos
Message 8 of 8
(4,062 Views)