LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass data to a 'popup' subVI from a main VI in a decent way

I will repeat what I have already said. YOU HAVE TO PUT THE READ OF THE GLOBAL INSIDE THE LOOP. And if you want each event to read the global, the read of the global has to be inside of each event. This is basic dataflow in LabVIEW. When a loop starts, all of the controls and variables outside of the loop are passed in once. The loop will not update these values until it is stopped and then started again. Do a simple experiment to see how a lopp runs. Create a while loop and right click on the conditional terminal and select 'Create Control'. Now drag that new control outside of the loop and wire it back up. Go to the front panel and make sure the stop control is set to false. Run the VI. You will find that you can click on the stop button an infinite number of times but the while loop will never receive the current value because the intitial value you passed in was false and there is no further updates possible, The only way to stop this VI is with the abort button. You're trying to do the same thing with putting the global outside the loop and eliminating any possibility of an update once the loop starts.
0 Kudos
Message 21 of 27
(970 Views)
Ok. I will try that again and let you know. Thank you for the responses.
 
KM
0 Kudos
Message 22 of 27
(965 Views)

Hi Dennis, I'm doing a similar thing - passing data to a seperate popup using a global variable. Data transfer ok if I run the popup manually, but not when it is opened from the original vi. I've cut it right back for simplicity in the attached.

 

Very grateful for your help.

 

 

Graham

Download All
0 Kudos
Message 23 of 27
(696 Views)

It's dataflow - when the subVI is called, the loop in the caller stops iterating, because it's waiting for the subVI to return, so no new random values are being generated. It's helpful to use execution highlighting to debug things, because that would have shown you the issue immediately.

 

One option is to run the VI dynamically. Another is to run it in parallel and use a static VI reference to call the FP.Open method or pass a message to the VI to open its own FP.


___________________
Try to take over the world!
0 Kudos
Message 24 of 27
(680 Views)

Thank you tst. I understand the error, but your second paragraph is fairly meaningless to me at the moment - my task for today.

 

Graham 

0 Kudos
Message 25 of 27
(668 Views)

Well, I have what I was after (in the case structure version of the attached), but I'm curious to know why it doesn't allow reentrant vi's as the event structure does.

 

 

G

Download All
0 Kudos
Message 26 of 27
(663 Views)

@grahamwebb wrote:

but I'm curious to know why it doesn't allow reentrant vi's as the event structure does.


Then it helps looking for examples, searching, or reading the documentation. Not so thin hint - look at the help for the OVR function.


___________________
Try to take over the world!
0 Kudos
Message 27 of 27
(657 Views)