LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

small program generating bar code type serial numbers

ok, at our physics lab we build these photomultiplier tubes which have jumpers on them that get set to specific addresses... these are (i believe) 12 bit addresses so we have 4096 unique serial numbers to cycle through... i have to write a program to generate these numbers and once a number is used, it has to be tagged so as not to be used again... or however the best way is to handle this...also, previously this had been done through a log book... so i need to input numbers in that have already been used... i'm new at this so basically my question is... what's the best way to start such a program? thank you in advance...

Christina
0 Kudos
Message 1 of 2
(2,641 Views)
One way of doing this would be to initialise a Boolean array with 4096
elements, i.e. one for each number, then use Replace Array Element to
set/clear each one as needed, Index Array to check whether an
individual number has been used and Search 1D Array to find the first
unused number.

Another way would be to use an array of integers to hold the numbers
that have been used, use Search 1D Array to check whether a given
number exists in the array or not, and Build Array to add a new number
to the end of the array. To find the first unused number you'd
probably have to use a For loop and search the array repeatedly until
you didn't get a match, unless anyone can think of a better method.
I'm assuming that the used numbers are not necessarily in a continuous
block.
..

The advantage of the second way is that you aren't limited to 4096
values, in case you go above this in the future.

In either case you can use the standard read/write file functions to
load and save the array on disc in LabVIEW binary format, or you can
use these together with Spreadsheet String to Array and Array to
Spreadsheet String to save as a text file - this would be better for
compatibility as you could also read it in Excel etc.

Within your program, you might want to use a functional global VI to
hold the current array value (in an uninitialised shift register of a
while loop), and you could also incorporate the save and load
functions in this VI.

Hope that's enough to get you started...
0 Kudos
Message 2 of 2
(2,641 Views)