LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Subvi will not terminate

Highlighted

I am having issues with terminating a subvi. From searching the forum, I have found that several people want a similar setup, but I was unable to find one that met my needs. I am trying to have a "main" vi that have "links" to other "vi's" so that when you click the button on the main front panel, the front panel of the subvi opens. This part I was able to accomplish fine, however, I have been having difficulty terminating and closing just the vi without causing an error across the entire setup or terminating the entire setup. The main issue in the sample code below, is that the front panel will close, but will still be running in the background, as can be seen when looking at the main vi. Any help would

be greatly appreciated. The main vi is labeled "trial.vi" and the subvi is "furnace 1."

 

Thank you for your time

0 Kudos
Message 1 of 5
(1,018 Views)

In Furnace.vi you have two loops with event structures.  That is generally not a good idea.  Please read the caveats about event structures in the help.  Second, both event structures have subVIs which are quite complex, containing their own event structures.  Event structures should not contain any code which takes more than perhaps a few tens of milliseconds to execute.  Anything longer than that should be in a parallel loop. Those loops will not respond to the stop buttons until after an event occurs.

 

Similarly, Trial.vi will not stop unitl the stop button is read and the event structure executes.  Since the Stop button will probably be read before an event occurs, another iteration of the loop will likely occur after the stop button is pressed, meaing that it will wait for another event to occur and complete before stopping.

 

I would be amazed if you could actually get this thing to stop!

 

Look at Producer/Consumer (Events) Design Pattern.  I suspect that you can do everything you need to do with two loops and one event structure.

 

Lynn

Message 2 of 5
(1,010 Views)
Highlighted

I will take a look at that. Thank you for your help!

0 Kudos
Message 3 of 5
(986 Views)
Highlighted

Also you need a better way of stopping your loops. Here is one method.

=====================
LabVIEW 2012


0 Kudos
Message 4 of 5
(977 Views)
Highlighted

I think that I tried something similar to that solution. It is not in the sample one that I posted, but basically what I tried was using a local variable connected to a stop and then the rest of the stops for the loops referenced the value written by that local variable, which I think is kind of how that example you show is set up, with the exception that you have global variables.

0 Kudos
Message 5 of 5
(955 Views)