10-18-2012 05:03 PM
Hi all,
Here is my problem. I want to start a subVI from my top level VI. I want to stop the subVI using an event generated from the top level. I dont know why but it doesnt work. Any suggestions?
I use Labview 2011.
thank you.
Cedric
10-18-2012 05:09 PM
Becuase you never exit your Start event case when you call the subVI. The event case cannot exit until the subVI completes. You need to dynamically call the subVI and not wait for it to complete. You can use the "Start Asynchrous Call" VI to start the subVI.
Also, the Wait 200 you have in the loop with the event structure is not necessary. The loop will be idle and only run when an event is fired. You also don't need the timeout event in your main.vi. It is doing nothing but consuming resoureces since you have no code in your timeout case.
10-18-2012 09:31 PM
Hi Mike,
Is there another solution without using the ''Start Asynchronous Call" function?
thank you
Cedric
10-18-2012 10:19 PM
Hi,
I worked around another solution and I implemented a Producer/consumer strategy (see attached VIs, Labview 2011). There is something very strange because when I press 'start' and then 'Stop', it works well, the second time I press the 'start' then 'stop', it works well. But the third time I press 'start' then 'stop', nothing appends! The event seems not working properly because the SubVi doesn't output the text 'END'.
Any ideas why there is such behavior?
Thank you.
Cedric
10-19-2012 12:34 AM
I am not sure what is going on with your VIs. That is some odd behavior. I am curious though, why don't you want to use the Start Asychrous Call?
Also, I generally don't handle events for controls on other VIs. For what you are doing I would use user events.
10-19-2012 09:05 AM
Hi Mark,
I dont want to use the 'Start asynchronous call' because I want to get an output from the function. Using such call, I have to use the 'wait asynchronous' function which is not adapted to my application because It is quite complex to implement.
If you think that the 'user event' is better adapted for my case, do you have an example of such implementation?
thank you.
Cedric
10-19-2012 10:29 AM
@Cedric51 wrote:
Hi Mark,
I dont want to use the 'Start asynchronous call' because I want to get an output from the function. Using such call, I have to use the 'wait asynchronous' function which is not adapted to my application because It is quite complex to implement.
If you think that the 'user event' is better adapted for my case, do you have an example of such implementation?
thank you.
Cedric
You can always get data from a VI that was started using the Asychronous Call by using queues, notifiers or user events to send data out.