LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Main vi and sub vi execution

Solved!
Go to solution

I am struggling a lot with my Main vi and Subvi execution problems a lot !

I have a complicated system. To explain it, I create a simple main vi and 2 subvis. Please have a look at the attachment.

It is working as expected. The boolean button in the main vi is active when the subvi-s are not running. But while the sub vis are running I can not access the boolean button. I understand why it is happening. The execution is stuck in the subvi and can not see any new input in the main vi.

My question is how can I solve this?

What I want is,

1. When the subvi is running, I still want the boolean button in the main vi to behave in the same way as compared to when the subvi is not running.

2. I should also be able to run the 2nd subvi when the 1st subvi is still running.

Please help me out (I am using Labview 2010.)

Download All
0 Kudos
Message 1 of 9
(4,714 Views)

I would put the other subVIs in parallel with your event loop.  What you need to do is send commands (via a queue or notifier) to tell the subVIs to run and/or show their front panel..  Do a search for the Master/Slave, Producer/Comsumer, and Queued State Machine architectures to get a better idea of how to set this up.  The idea is that the code can run in parallel with the event generator.  You can also send down commands to update controls or even tell the subVIs to stop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 9
(4,697 Views)

Hi Crossrulz,

 

 I have tried master/Slave, Queue/Notifer structures with this. I am not being able to set up the problem. Is it possible that you can make an example with my vis(in the main post). I know how you can send queue to the subvi. But this has to be the other way. You have to extract the queue from the subvi somehow! 

 

It would be very helpful for me if you can make an example with my problem. Please save it as LV-2010.

 

Thanks.

0 Kudos
Message 3 of 9
(4,676 Views)

I assume you want to stop the sub-vi's when pressing stop? Create a User event and wire it to the sub-vi's, and have the Stop-button event generate this user event.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 4 of 9
(4,656 Views)

An example with (hopefully) the desired functionality attached. If you have any troubles understanding what's going on in the VI's I'll be happy to answer any questions.

Download All
0 Kudos
Message 5 of 9
(4,633 Views)

Hi Samli,

 

 I can not open the vi-s. Can you please post them as LV-2010 version.

 

Thanks.

0 Kudos
Message 6 of 9
(4,624 Views)
Solution
Accepted by babu726

Oh sorry, I thought I saved them to LV2010 but I guess I accidentally recompiled them to latest version.. Attached VI's for 2010.

 

Seems I cannot edit my previous post so forgive me for sending VI's twice and if any moderators happen to see this, feel free to remove the VI's in previous message..

Download All
0 Kudos
Message 7 of 9
(4,620 Views)

Thank you very much for your answer. This is exactly what I was looking for.

 

I have one more question. If I want the 'Call Subvi' boolean buttons to be in the same loop and the same event structure (may be as 'value change'), how can we make it work?

As it is, if I put them in the event structure on the same loop, it looses the functionality.

This may be a very lame question. Sorry for that.

0 Kudos
Message 8 of 9
(4,581 Views)

Hi babu726, 

 

Are you trying to run everything in the same while loop?  If one subVI is running in a while loop, the loop will not finish its iteration until the subVI has completed.  The purpose of having three while loops was to allow independent control of each VI (main, sub1, and sub2).  Can you post updated code with what you are trying to do?

0 Kudos
Message 9 of 9
(4,542 Views)