Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Updating a LabVIEW GUI from a subVI

Tags:

labview

I'm writing a program to control two similar devices in Labview. In order to avoid copying the code I use subVIs. But I have a piece of code where I update some values on the GUI inside a while loop. I'd like to know if it is possible to somehow have this loop inside my subVI and have the subVI sending one of the output parameters after each iteration.

like image 252
user2738748 Avatar asked Jul 30 '15 09:07

user2738748


1 Answers

To update your GUI from within a subVI you can do one of the following:

  • Create a queue or notifier in your top level VI and pass the reference in to your subVI. In the subVI, send the data to the queue or notifier. In the top level VI, have a loop that waits for data on the queue or notifier and writes that to the front panel indicator.
  • Create a control reference to the front panel indicator in the top level VI and pass the reference to your subVI. In the subVI, use a property node to write the Value property of the indicator.

If you look at the LabVIEW help for the terms in bold you'll find documentation and examples for how to use them.

Of these options, I would use a queue for any data where it's important that the top level VI receives every data point (e.g. if the data is being plotted on a chart or logged to a file) or a notifier where it's only necessary that the user sees the latest value. Using control references for this purpose is a bit 'quick and dirty' and can cause performance issues.

If you need to update more than a couple of indicators like this, you'll probably want to build a cluster containing the data you send to the queue/notifier, or containing the control references. Save your cluster as a typedef so that you can modify its contents without breaking your code.

like image 111
nekomatic Avatar answered Nov 07 '22 13:11

nekomatic