LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SUB VI Output

Solved!
Go to solution

hello,

 

i have simple question and i could not find the answer here .

i have sub vi, which has while loop inside , which makes 500 measurements with DT9837A module.

the output of this subvi is connected with numeric indicator in the main VI.

My problem is that the values of the measurements do not update in the main VI simultaneously.

 

any hekp would be appreciated

thank you

0 Kudos
Message 1 of 8
(2,758 Views)

without seeing your code it is hard to help. But a wild guess is that you have just wired the data from within the loop to the outside of the VI and then to the connector pane and then to an indicator in the main VI. If you want updates for every value iteration in the loop, but without exiting the VI, then you need to somehow send the data to the main VI. There are many mechanisms for that...

Certified LabVIEW Architect
Message 2 of 8
(2,735 Views)

Thank you for your reply,

 

i have tried to make screenshoots and i hope so it would be clear. 

0 Kudos
Message 3 of 8
(2,723 Views)

if needed i can upload the whole vi's ..

thank you again  

0 Kudos
Message 4 of 8
(2,720 Views)

@thols wrote:

 There are many mechanisms for that...

 

for example ??


 

0 Kudos
Message 5 of 8
(2,718 Views)
Solution
Accepted by topic author moha_affa
Message 6 of 8
(2,701 Views)

Hi moha_affa,

 

I'd suggest building an array of those 4 values in your subVI, and then using either a Queue or a Notifier pass those values (as a block) to the calling (main) VI.

 

You can then dequeue the element (which is an array of 4 elements) if you're using a Queue, or Wait on Notification for the same (if using a notifier) and update the main VI inside its own While loop. Take care not to run the subVI in the loop - this isn't what you're looking for.

 

For an example using Queues to communicate between loops, see Producer/Consumer. Now you can just imagine that the Producer loop is inside your subVI, and connect a Queue Reference as an input for the SubVI's connector pane.

 

A simple example with just one number is shown below:

Main VIMain VI


subVIsubVI

Note that with this arrangement, the last value generated by the subVI will never be sent to the main VI (because of the way the queue is stopped). Usually for a real application, you should implement a stopping mechanism that doesn't depend on the Queue erroring!


GCentral
0 Kudos
Message 7 of 8
(2,673 Views)

 

 


@thols wrote:

The simplest might be this: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019PGuSAM&l=sv-SE


it has worked thank you very much

0 Kudos
Message 8 of 8
(2,625 Views)