LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

References with SubVIs

Hi,

I have SubVI that should pass data to mainVi and vice versa, while both Vis are running.
If I have undestood correctly this must be done with references.
In code subVi is upper left corner of block diagram (Kytta2.vi). My problem is to get for example Kytta2:vi`s value "K Kaannon asema-anturin arvo" connected to main vi`s indicator "Kaannon asema-anturin arvo" and to get values shifted same time while both, mainvi (PARAL2.vi) and subvi(Kytta2.vi) are running.

I have placed already "Call By Refence Node" in the loop where subvi is, but I don`t what else must be done to get data in and out subvi, while both vis are running.
Somebody, help?

PS: I have LabVIEW 6.i
- Santtu
0 Kudos
Message 1 of 6
(2,845 Views)
Hi Santtu,

firstly, references ARE a way of doing this, but I would recommend a different, more efficient method. I would use a QUEUE to pass the data. Using a QUEUE (or more specifically a named QUEUE) involves less overhead, and the actions don't have to run in the UI thread (AFAIK).

You can load a sub-vi using VI server in such a way that it's outside the data flow of the main program. Using QUEUES wo communicate, you have something like a background process. I've done this before, and it works quite well. You can have several VIs running in the background using this approach, each seperated from the usual data-flow of the main program. Kind of like LV-services really.

Hope this helps

Shane.

PS if you need more information on how to launch the VIs, let me know.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 2 of 6
(2,838 Views)
Hi, Shane.

Those queues are complitely new thing to me. Can explain little more specific what should I do, or it would be even better if You have some small example how to pass data from SubVI to MainVI via queue and vice versa?

Can I bring all SubVI`s data via one queue or do I need to create one queue for each subvi`s control and indicator?
And most important question, how is it done? 🙂
- Santtu
0 Kudos
Message 3 of 6
(2,836 Views)
Hi Santtu,

here's an example of how to launch a VI in the background. Please not that the data used for my example is not real. The data type of the "cluster" in my example MUST match the data type in your Sub-VI if you want it to work.

The best place to look for QUEUE examples are in the examples which are sent with LabVIEW. That's how I learned to use them.

Having said all this, I'm actually not sure that QUEUES are available in 6.i. I originally read your mail and understood that you have 6.1, but the QUEUE examples are new to 6.1, so it might be that the QUEUE approach isn't available in 6.i. If not (I don't have 6.i, so I can't check) sorry for the confusion.

Hope this helps

Shane.
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 4 of 6
(2,829 Views)
Hi again,

By the way, I think that labview version 6.i means that any labview in 6 series...
My labview is 6.0 and I can´t open that example code, damn.
- Santtu
0 Kudos
Message 5 of 6
(2,827 Views)
LabVIEW 6.i is a different version of LabVIEW to 6.1 and to 6.0 AFAIK.

I know LabVIEW 6.i WAS released as a version of LabVIEW.

This is clear as soon as you can't open the example. It is saved in LV 6.1.

Here's a version saved on 6.0.

Sorry.

Shane.

Message Edited by shoneill on 06-21-2005 10:47 AM

Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
0 Kudos
Message 6 of 6
(2,824 Views)