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

Post it in 7.0.

___________________
Try to take over the world!
0 Kudos
Message 11 of 27
(1,593 Views)
Hmm, when I save the llb with options, VI's keep missing, also when I open just one VI from the 7.1 llb and save it with options to 7.0 it stays a .llb with the VI converted and the global vars inside it... Smiley Indifferent
0 Kudos
Message 12 of 27
(1,592 Views)

Both the application builder and the save for previous option only save the VIs which are explicitly called.

If you call a VI dynamically, you need to include it in the build in the source files tab of the app builder.

For the save for previous, you need to open and save each dynamically called VI seperately. You can save all of them into a single LLB, but it will take a few steps.

LLBs are good for passing complete applications from one place to another. They are not good if you want to have functions which will be used by many programs and are subject to change.

You should note that when you build an EXE, the EXE is actually an LLB with all your files inside it, so if you had a VI in c:\bar.vi it will now be c:\foo.exe\bar.vi (for example). This means that if you rely on the VI path to get the other VI path, you need to do an extra strip path when running an EXE. You can check for it using the Application.Kind property. You can also download the OpenG File VIs which also do this.


___________________
Try to take over the world!
0 Kudos
Message 13 of 27
(1,585 Views)

Hi Kimjansen,

I seem to have a similar situation as this post and I am not sure if I understand how you have solved the problem.  Here is my scenario:

I have a main VI which calls a subVI based on an event (button click). The subVI is configured such that it opens its FP when called and closed afterwards.

I am unable to pass data continuously from my main VI to the subVI.  I have to use event based structure because my program demands that.  I have attached a simulated version of my code. I'd appreciate your response. 

Thanks in advance

KM

Download All
0 Kudos
Message 14 of 27
(1,494 Views)

Using a local variable is incorrect. The value of the local is set when you first call the subVI and since a local variable doesn't exist outside of the VI (hence the term 'local'), the subVI cannot keep reading it as it changes. You could instead write to a GLOBAL variable and have the subVI read that. You could also write to a control in the main VI and pass a reference of it to the subVI. The subVI would then do a Value property read. In the subVI, you also need to do the read with the variable/reference inside of the timeout event. Putting it outside means that the subVI will read it once and then will not update anymore. The image shows a regular LabVIEW global variable but it's probably better to use a LV2 style functional global as it's called. Do a search for taht and you'll find some complete explanations but it's basically a regular VI with an unitialized shift register.

Message Edited by Dennis Knutson on 10-24-2006 01:05 PM

0 Kudos
Message 15 of 27
(1,486 Views)

Dennis,

Thank you for the quick response.  I guess I should have explained my application in more detail.  I tried with the Globals before posting. Here is my actual scenario:

I am continuously reading and parsing data via TCP/IP in my Main VI.  I have a subVI which is event driven to configure settings.  This subVI opens its FP when the "Configure" button sees a value change.  There are several configuration settings in my Configure VI, which are event driven.  I'd like to pass the TCP read data from the Main VI to the Configure VI continously.  It works fine if I don't open my SubVI. But if I open it, then the data doesn't get updated on my SubVI. 

I have attached my code. It is very messy right now as I am still in the development stages.

I'd appreciate any advise. Thanks

0 Kudos
Message 16 of 27
(1,476 Views)
It is sort of messy but the subVI will not read the globabl variable unless there is a value change event on one the controls you have specified. In the simple example you posted, you had a timeout event in the subVI that I modified to read the global whenver there wasn't an event. Could you just duplicate the code you already have and add it to a timeout event?
0 Kudos
Message 17 of 27
(1,469 Views)
i'll try doing that... meanwhile, is there a way to continuously update the value in the subVI without putting timeout it in the event structure.. in other words,  i'd like the data to be passed onto the subvi as it gets updated in the main vi.. but not within the event structure... i think that if i didnt use the event structure, i could directly pass on the value from the main to the sub vi by either wiring it in or using globals.

thanks
km

0 Kudos
Message 18 of 27
(1,461 Views)
Of course you can have something other than a timeout event. You can just have it inside regular while loop with no event structure at all. You'll never be able to get it to work by wiring in a control to the subVI. LabVIEW just doesn't work that way (neither do other programming languages). You could however, wire in a reference to an indicator on the main's front panel and read the indicator's value property as I previously mentioned. Here's a very simple example of control references.
0 Kudos
Message 19 of 27
(1,456 Views)

Hi Dennis,

Thank you for being so responsive.  I guess I am not explaning my situation the best way.  i totally understand your recommendations, but that is not meeting the requirements.  I have re-posed the "simple" code again with some modifications.

My question:  How do I pass the current value from A (in the test main.vi) to B2 (in the test sub.vi)? The test sub.vi is configured to open its FP when called and close afterwards.

Thank you in advance

km

0 Kudos
Message 20 of 27
(1,424 Views)