LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How could I get the instant value from the SubVI to the Main VI?

I would like the get the instant value (interval) from the SubVI to Main VI?
The reading from the SubVI just can be shown the last value in the Main VI.
I want to make it shown the value by every updated. Thanks!


Message Edited by perry3181 on 03-02-2008 08:14 PM
0 Kudos
Message 1 of 8
(3,482 Views)

Pass a reference to the control from the main VI to the subVI.  In the sub VI you can pass the reference into a property node and set the value property.



Message Edited by Ravens Fan on 03-02-2008 10:13 PM
Message 2 of 8
(3,477 Views)

With explicit example VIs in LV 8.5... Smiley Happy

Just to explain more if what Ravens Fan had said(shown)... Smiley Wink

- Partha ( CLD until Oct 2027 🙂 )
Download All
0 Kudos
Message 3 of 8
(3,465 Views)
While this method works, it carries a fairly significant performance penalty.  If you are updating more than about 20 times per second, you will want to use a different approach.  Details on both points below.
 
Performance Penalty
 
Each time you make a call to VI server, you force a thread switch to the UI thread.  This thread thrashing can significantly slow down execution.  In addition, when you write a front panel control/indicator using VI server, the operation must totally complete before the execution thread can continue.  This means all front panel updates must complete - it is not simply updating a single memory location.  In contrast, when you write to a local variable or indicator terminal, you notify LabVIEW that the front panel control needs to be refreshed, and this happens on the next UI refresh cycle (about 30Hz).  As a result, you can write to an indicator or local variable orders of magnitude faster than doing the same operation using the Value property.
 
Faster Approach
 
This leads to the faster approach.  In your main VI, create a queue with the proper data type.  Pass the queue reference to the subVI.  Any time you want to update the main VI front panel control, enqueue the value.  In the main VI, create a WHILE loop to process the queue.  Every time the queue receives a value, write it to the front panel using the terminal or a local variable.  You get a speed-up two ways.  First, you no longer get a thread switch in your subVI every time you want to update the front panel.  Second, you use the optimized LabVIEW UI update mechanism instead of forcing a full update every time you have a change.
 
If you need the faster method and need more help on it, let us know.
Message 4 of 8
(3,447 Views)
Can you give me an simple example program for the faster approach. I have problems with the reconstruction of your explanation.
THX
0 Kudos
Message 5 of 8
(3,356 Views)
Hi Mighty...,

have you looked into LV examples (general/queue.llb)???
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 8
(3,336 Views)
I have just started working with LabVIEW. I'm not able to relate these examples, they are too difficult. I'm searching for something like the little program above from Ravens Fan.
0 Kudos
Message 7 of 8
(3,324 Views)
Hi Mighty...,

well, Raven's example is not a vi - it's just a concept drawing 🙂
And the BasicQueue.vi (from mentioned examples) really isn't difficult and contains a lot of explanations...
Best regards,
GerdW


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