09-15-2005 07:05 AM
09-15-2005 07:14 AM
Diogo,
Without seeing your code, I am not sure if the following solution will work although I think it should. The first thing is to replace the for loop in the subVI with a while loop (you can tunnel into and out of a while loop just as well as with a for loop, although this is not the default setting). The second step would be to create a reference to your Stop conrol in the Main VI and have this wired into the Sub VI. You can create a Property Node for this reference in the SubVI and wire the Value property to the stop icon in the While Loop. This way, when you press Stop in the Main VI it will also stop execution of your loop in the Sub VI without losing any functionality of your original for loop (except for a bit more software overhead by reading the property node in the while loop)
I hope this helps - I'm sure there are other possible implementations that might also solve your problem equally well.
09-15-2005 07:19 AM - edited 09-15-2005 07:19 AM
Message Edited by Dynamik on 09-15-2005 07:31 AM
Message Edited by Dynamik on 09-15-2005 07:33 AM
09-15-2005 07:28 AM
09-15-2005 07:38 AM
Hi Diogo,
I saved it in 7.0 (first time) please let me know if it's OK.
09-15-2005 07:48 AM
Thank you very much, Dynamik. It is exactly what I need! Now i shall implement it on my vi's. A.C.E was also right when he suggested using the while loop instead of a for loop.
Best regards,
Diogo Montalvão (Lisbon, Portugal)
02-14-2011 12:12 AM
Hi,
I found this thread very helpful. May I ask one thing - what is the purpose of the Occurrence?? If I try it without implementing the Occurrence (neither in main VI or subVI), labview crashes when the subVI completes its task or is stopped from the mainVI.
Thanks for your help!
Hong
02-14-2011 03:28 AM
02-14-2011 03:44 AM
hong2011 wrote:I found this thread very helpful. May I ask one thing - what is the purpose of the Occurrence?? If I try it without implementing the Occurrence (neither in main VI or subVI), labview crashes when the subVI completes its task or is stopped from the mainVI.
A lot of things changed in the last 6 years, so this thread is a bit stale and there are a few other ways to do it. (For example we can have a FOR loop with a conditional terminal).
You don't provide enough information to answer your question why it crashes. It would be more interesting to know what you are "using" and not what you are "not using". This is not something we can guess by elimination. 😉
LabVIEW should never crash, so please show us the code that crashes so NI can fix it. What LabVIEW version are you using?