LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I send a text message to the front panel when using sub VI's?

I am trying to send text strings to the front panel to inform the user what stage of the test is being executed. I have sub-VI's so I tried passing a global variable to an indicator in the main VI, but that would only execute once unless I put it in an infinite loop. There must be a better way.
0 Kudos
Message 1 of 14
(4,098 Views)
You can try better using local variables, but i think globals are right too. An example is attached.
Hope this helps
Message 2 of 14
(4,098 Views)
Maybe the following option can work for you.

I manage to do something similar in a different way. I was able to divide the test in steps, and thus able to use a sequence structure. Each frame is equivalent to the stage in execution. So, I created a string indicator, place the node outside the sequence structure and created local variables placing them on the necessary frames in the sequence, wiring a string with the desired information about the stage.

Attached is an example.

Best regards
www.vartortech.com
0 Kudos
Message 3 of 14
(4,098 Views)
Put it in a while loop along with a global stop. When your program ends
write a false to the global stop to stop the while. Thats the only way I
know.

"radarguy" wrote in message
news:506500000008000000841E0000-986697009000@quiq.com...
> I am trying to send text strings to the front panel to inform the user
> what stage of the test is being executed. I have sub-VI's so I tried
> passing a global variable to an indicator in the main VI, but that
> would only execute once unless I put it in an infinite loop. There
> must be a better way.
0 Kudos
Message 4 of 14
(4,098 Views)
radarguy wrote:

> I am trying to send text strings to the front panel to inform the user
> what stage of the test is being executed. I have sub-VI's so I tried
> passing a global variable to an indicator in the main VI, but that
> would only execute once unless I put it in an infinite loop. There
> must be a better way.

There are several possibilities as far as I can understand your question:
- You can use DataSocket (especially in LV6, allowing direct control
assignment to data sourse)
- You can use references and VI server functionality, opening VI
reference from current stage sub-vi and getting desired control
reference for updating it's value.
- You can use Notification and/or semaphore vi's and wait for
notification in main vi using separate pa
rallel while loop.

The all ways have good examples in LV installation and on ni.com. Search
these sources.
--
Sergey Krasnishov
____________________________________
Automated Control Systems
National Instruments Alliance Member
Moscow, Russia
sergey_acs@levsha.ru
http://acs.levsha.ru
0 Kudos
Message 5 of 14
(4,098 Views)
I do this all the time. I have 0 (zero) connections to my front panel controls and indicators with the entire program running in sub-VI's. Sometimes I set the entire front panel in its own VI. I have created a library of functions to write to and read from controls and indicators.

Just feed the name of the VI with the control you want to modify into the "Open Reference.vi" and connect the reference output to the appropriate sub-VI. Don't forget to use the "Destroy Reference.vi when you are done (this releases all of the memory taken up by the references). This is a pseudo-object-oriented approach.

I have attached the library of vi's for you.
Message 6 of 14
(4,098 Views)
Rob,

You rawk! This is exactly what I was looking for. Thanks!
0 Kudos
Message 8 of 14
(4,098 Views)
No problem. This also gives possibilities for testing VIs. The VI that you reference only has to be in memory and does not even have to be running. I have used references to generate streams of data into existing VIs to test how they react. Automated testing of my automated test program. 🙂
0 Kudos
Message 9 of 14
(4,098 Views)
Hi Radarguy,

If you are using LV6i, you can create a reference to your indicator and
pass the reference to your sub-vi. The sub-vi can change the 'value'
attribute for the indicator and that should update on the top level vi.

Tim

radarguy wrote:

> I am trying to send text strings to the front panel to inform the user
> what stage of the test is being executed. I have sub-VI's so I tried
> passing a global variable to an indicator in the main VI, but that
> would only execute once unless I put it in an infinite loop. There
> must be a better way.
0 Kudos
Message 7 of 14
(4,098 Views)
There is a lazy way of doing this without doing any coding. You can try to use the datasocket. You will be able to achive your objective without any coding. I have used this in the past. to me it looks like the cleanest approach when you have several instances where you had to write to calling vi from a sub vi. You dont have to bother about references and other stuff.
0 Kudos
Message 10 of 14
(4,098 Views)