05-03-2013 01:51 PM
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.)
Solved! Go to Solution.
05-03-2013 03:03 PM
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.
05-03-2013 05:44 PM
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.
05-04-2013 12:35 PM
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
05-05-2013 09:54 AM
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.
05-05-2013 11:06 AM
Hi Samli,
I can not open the vi-s. Can you please post them as LV-2010 version.
Thanks.
05-05-2013 11:20 AM
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..
05-07-2013 08:13 AM
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.
05-08-2013 05:44 PM
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?