LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to display the status of a SubVI on the front panel?

Hi,

I am writing a program to control an instrument through a serial communication port. The control and communication functions are integrated in a SubVI and they work fine.

In the front panel of the main VI, I want to add some indicators to display the status of those controls in real time, such as using some LEDs to show whether the program is running in some loops of the SubVI, or use some indicators to show some variables in the SubVI.

I tried using global variables, but I can't make them work in real time (or maybe I didn't do it right). The values of the global variables are actually changing on the fly, but the indicators on the front panel wouldn't reflect those changes until the program return
ed from the SubVI.

Is there a way to do this in Labview 6.0.2?

Your earlist help is very much appreciated.

Best regards,
Hua
0 Kudos
Message 1 of 10
(3,949 Views)
You can try right click SubVI>>SubVi Node Setup..>>tick "Show Front Panel when called" and "Close afterwards if originally closed".
0 Kudos
Message 2 of 10
(3,949 Views)
You could try passing references to the front panel indicators to the subvi. Then in the subvi you use a property node to write to the front panel indicator.

Your globals didn't work because you had the indicators and the subvi in the same loop in your main vi. This approach would have worked if the indicators were in a separate (parallel) loop. However, globals are generally frowned upon in LV programming due to their potential for causing race conditions.
Message 3 of 10
(3,949 Views)
I am not sure how fast you need them to update, but there is also front panel datasocket, which would require no new programing.
0 Kudos
Message 4 of 10
(3,949 Views)
Thanks, John. I will try your solution with references and a property node.

About the globals in my program, I connected them directly to those indicators outside all the loops. But still they are executed sequentially... when the program runs into a subvi or a loop, it won't come out to refresh the indicators until it is done in the subvi or the loop.

If I can write the indicators of the main vi from inside of a subvi, then I guess it will do the job. Thanks again for your hints.
0 Kudos
Message 5 of 10
(3,949 Views)
Hi John,

I can't figured out how to pass references of the front panel indicators to a subvi. Could you please take a look at the attached two very simple VIs and make necessary modifications to show me how to do that?

Your help is very much appreciated.

Hua
0 Kudos
Message 6 of 10
(3,949 Views)
Sorry, forgot to attach the file.
0 Kudos
Message 7 of 10
(3,949 Views)
Hua,

I have attached an example in which a front panel boolean indicator is toggled in the subvi. Also, a front panel stop button is used to stop the loop execution in the subvi. References are passed to the subvi instead of the actual control values.

Without seeing your code I'm not sure what was going on with the globals, but you had to have a data dependency somewhere which was keeping the code from running until after the execution of the subvi. The code must be totally independent of the subvi in order to run. Also, in order for the update to work it would have to be operating in a loop.
Download All
Message 8 of 10
(3,949 Views)
Thanks, John. But would you please save the two VIs for Labview 6.0.2 or earlier? I only have access to 6.0.2.
0 Kudos
Message 9 of 10
(3,949 Views)
Here it is in version 6.0
Download All
0 Kudos
Message 10 of 10
(3,949 Views)