LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Instantaneous Output to MainVI from Currently Running SubVI

My mainVI calls a subVI which outputs a value based on the given input. I want the output from the subVI to update in my mainVI instantaneously as the subVI is running. Currenlty the output in my mainVI arrives only after the subVI has completed execution. I need to have instantaneous output from subVI in my mainVI so that way I can use that instantaneous value to do other calcuations. 

 

I tried using reference as the output, but even with that method the output only arrives at the end of the subVI execution. 

 

 

 

subvi-mainvi instantaneous output

Download All
0 Kudos
Message 1 of 2
(2,508 Views)

Your VIs are a mess and full of race conditions and beginner mistakes. Many code parts don't make a lot of sense.

 

If you read and write to local variables (e.g. the done?" boolean), you need to ensure that it is set to FALSE before the loop starts and the code has a chance to read the potentially stale value. Else you get race conditions. (LabVIEW does not execute left-to-right, execution order is only determined by dataflow).

Incrementing in a loop is better done with shift registers instead of hordes of local variables.

 

Here's a simplified and corrected version. See if it does what you want. Modify as needed. There are many improvements possible.

Download All
0 Kudos
Message 2 of 2
(2,493 Views)