LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Changing front-panel boolean indicators from a sub-vi: global variables vs passing reference vs passing single values vs passing arrays

Hi, I've got a few of these different methods working in practice, however, I would appreciate the viewpoints of some experienced labview users to decide which is best for my application - I'd be thankful for any help you can offer me.
 
The application I'm building at the moment is a simple state-machine based tester. It carries out six tests, then at the end decides whether the DUT passes or fails. I'd like to have "pass" and "fail" LEDs on the front panel for each test. ie. 12 LEDs. However, since six devices will be being tested in parallel, there'll be 72 LEDs total on the front panel.
 
So, the basic hierarchy structure of my program is as follows:
 
UserInterface.vi (with the front panel LEDs)
      - FullTest.vi (carries out test on DUT#1, then passes "Pass" or "Fail" LED info to UserInterface.vi)
      - FullTest.vi (carries out test on DUT#2, then passes "Pass" or "Fail" LED info to UserInterface.vi)
      - FullTest.vi (carries out test on DUT#3, then passes "Pass" or "Fail" LED info to UserInterface.vi)
      - FullTest.vi (carries out test on DUT#4, then passes "Pass" or "Fail" LED info to UserInterface.vi)
      - FullTest.vi (carries out test on DUT#5, then passes "Pass" or "Fail" LED info to UserInterface.vi)
      - FullTest.vi (carries out test on DUT#6, then passes "Pass" or "Fail" LED info to UserInterface.vi)
 
I'd like to know how best to pass this "Pass"/"Fail" information upwards.
 
I've tried global variables, but end up with 72 of them. The other issue is, I don't want to create six versions of FullTest.vi, with each one referring to a different set of global variables.
 
I've tried passing references to arrays (I was thinking in terms of C pointers), but I've done some more reading on the forum and this sounds like a bad idea due to duplication of the arrays.

I could pass the array itself into FullTest.vi, and do a "Replace Array Subset", but this won't actually immediate change the LEDs on the front panel, will it?

Thanks for your patience.
0 Kudos
Message 1 of 6
(3,463 Views)
You could transfer the data as bit mapped U16s and then convert them to boolean arrays for display. In hex, if a pass was '1' then 0000111111111111 would equal 0x0FFF, so you would compare the overall result to that to determine overall pass or fail. In the display of LEDs you could adjust the size of the array of boolean to show only 12 elements, and you can hide index of the array. You can adjust the colors so that a '0' is red and a '1' is green. This might reduce the complexity somewhat.
0 Kudos
Message 2 of 6
(3,454 Views)
Thanks for your reply - that certainly would work for the boolean values, though I'd also like to make use of text strings (test name, test status..) on the front panel too, which is where the global variables and references would come in.
 
I've tried another approach which I'd appreciate some feedback on. For each of the LEDs on the front panel, I've created a Reference, all of which I've combined into an array. I've fed this array into the sub-vi, and then used Index Array to access each LED's reference once more. Any thoughts?

Thanks in advance.
0 Kudos
Message 3 of 6
(3,448 Views)
I don't think there is anything wrong with doing it that way. There is always the memory issue when using references. OTOH, you are using all this stuff just to display information to the user. Boolean controls have more functionality than just that; for instance you can wire them to a terminal on the connector pane and use the data value again. Here it sounds like you are only interested in display. You might try setting this whole thing up with a picture control, where your protocol is a region of the picture that each test will address rather than indicies of an array. If you serialize access to the picture control reference in your sub-vi by using a non-reentrant sub-vi then you can input the previous picture, modify the approprate region and then update the image, all with a reference in your sub-vi.
0 Kudos
Message 4 of 6
(3,429 Views)
ChrisC,

What I have done in such cases is to use a queue with cluster datatype. The first element is a typedef enum with the identity of the source of the information (DUT#i). The second is another typedef enum with the identity of the test (Test: Power). The third element is a string to which the data has been flattened (string="True" or string ="6.32"). By using the enums as selectors in a case structure the appropriate datatype for unflatten can be easily obtained.

You could use the same queue for all six devices since the data carries the information to allow the GUI to sort it out easily and the order in whic hte data arrives is irrelevant.

If you have large amounts of data such as arrays for a graph, a separate functional global for the array may be better, but it sounds like that does not apply to your current situation.

Lynn
0 Kudos
Message 5 of 6
(3,418 Views)
Thanks to both of you for your answers, I'll have a play with both of the ideas today and see what comes out of it. Much appreciated.
0 Kudos
Message 6 of 6
(3,408 Views)