LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Retrieving information from a running vi

I have a sub-VI that runs for a long time, and I need to know when an indicator of this sub-VI turns to "true" to start a new operation at a correct time. How should I do it? Using a global variable or what? I'd like to get this piece of information with minimum changes to the sub-VI (because someone else has programmed it, I'm in hurry and it is a bit complicated). It has been a couple of years since I have done LabVIEW, but if I remember correctly, simple wiring will not work because I need the information before the VI stops running.

 

0 Kudos
Message 1 of 7
(3,148 Views)
If the information is already in an indicator on the subVIs front panel, the least intrusive technique is a loop that uses VI server to periodically read the indicator value.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 2 of 7
(3,140 Views)

Hi sanar,

 

you could use globals. They will do this job - quick and dirty.

 

You can also use notifier or a queue. Both would allow you to stay away from polling loops: just write a value into the notifier/queue to get the "subVI" notified…

 

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 7
(3,138 Views)

I think your Global variable will do fine.

 

Alternatively you can use an "Action engine" or "Functional global"  , see Ben's nugget here Action Engine Nugget

You call the 'SET' from your 'long-time-subvi' and poll the setting in your other vi with 'GET'.

 

Or maybe a notifier is just what you are looking for... 

 

Many solutions will do, but I think the Global Variable will take least effort.

 

 

0 Kudos
Message 4 of 7
(3,128 Views)

Personally, I would go with the Notifier in this situation.  When the value goes TRUE, you send the notification.  Your other loops just use the Wait On Notification to sit there until the notification is sent.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 7
(3,119 Views)
Thank you for the help! This really saved me from quite a lot of manual reading. Let's see which option I'll get implemented first... -->
0 Kudos
Message 6 of 7
(3,099 Views)

What I've done in this situation, particularly when my calling VI has an indicator ("Goal Reached") that I want the sub-VI to set, is to pass a reference to my Indicator into the sub-VI.  The sub-VI can then use this to set the Goal Reached Value, or if I want to trigger an event, it could use the Value(Signal) Property and the caller could test for a change in an Event Structure.

 

Bob Schor

0 Kudos
Message 7 of 7
(3,080 Views)