LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Access data from a SubVi to the MainVi while the SubVi is still Running

I want to pass some Boolean/String from a subvi to the main vi while the subvi is still running. 

I understand that it could be done using queue/ notifier. I do not want to use global variables. I looked at different examples but failed to figure out how to do it.

I was trying to make an example by looking at an example from Labview about notifier. 

Can anyone please help me with this code and guide me to the correct way.

 

Thanks.

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

HI

 

The example you have build is using queues to transfer data from subVI to main VI.

I have modified example a bit.

Check the attached. You have to run both the VIs in order to see the data in the main VI.

Same functionality you can acheive by using notifiers also.

 

Hope this helps.

Download All
0 Kudos
Message 2 of 12
(2,845 Views)

Sorry, but can you please post in labview 2010 or earlier.. 

thanks.

0 Kudos
Message 3 of 12
(2,835 Views)

Hi

 

Here is the VI in LV 2010.

Download All
0 Kudos
Message 4 of 12
(2,833 Views)

You mentioned sub vi but you are not calling that sub vi in your main vi, then its just simply another vi running parallel. In real if you are planning to call the sub vi in your main vi you may need to call the vi in a parallel loop or you may have to dynamically call the sub vi. In your original code you are calling your main vi from the sub vi, just try to call the sub vi from the main vi.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 5 of 12
(2,825 Views)

Hi LV_user1,

 

Thanks for your time. I looked into your vi-s. They work fine. But, one thing is still not clear to me. I still need to call the sub-vi from the main VI. When I try to do that, by placing the subvi inside the while loop of the main vi, that does not work any more. I have to physically stop the Subvi to get the data out.  So how to deal with that?

0 Kudos
Message 6 of 12
(2,800 Views)

Keep the sub vi outside the main vi and run it will work. Thats what I mentioned before

-----

The best solution is the one you find it by yourself
0 Kudos
Message 7 of 12
(2,790 Views)

Hi P@Anand,

 

Sorry I could not understand what you are suggesting.

May be my question was not clear.

I want to use my subvi in the main vi. That is the main problem. So the main vi is waiting for the subvi to finish and then get any output from that. But instead what I want is to get the data out before the subvi finishes. 

 

I am stuck here and cannot overcome this problem. Can you please write a small example(LV-2010 please) for me! I understand my trial (Vi-s in the main post) was not correct to describe my problem. There I did not put any subvi in the main vi. 

0 Kudos
Message 8 of 12
(2,781 Views)

Hi babu726,

I have included a revised MainVi.vi and SubVi.vi for you. I had to modify the SubVi to get it to be called by the MainVi. I also included a disabled diagram structure with the code just copied and pasted in, since your code does not seem modular. Hopefully this helps!

Regards,

Michelle G
Applications Engineering
National Instruments
Download All
0 Kudos
Message 9 of 12
(2,762 Views)

Can you please post a LV-2010 version of the vi-s please.

0 Kudos
Message 10 of 12
(2,759 Views)