LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping Correctly With While Loop

Solved!
Go to solution

Hi,

 

I'm having trouble stopping the information that moves stages with a while loop I created (seen below). I attached the proram (LabView 8.5) for reference, just in case.

 

Currently, whenever I press the stop button designated for stage control, the stages will not stop until the last part of the stage movement pattern is complented (in this case part 7 of the stacked sequence). Now, I have tried various things, but this was the best I could do to make the stages stop at all. (all the other attempts resulted in awkward stage movement afetr the pattern or no stopping at all). Any ideas on what I can do? I'm positive that just putting a while loop over the stacked sequence was probably not a good idea. I also know stacked sequences are generally frowned upon (or so it seems) but I it was rather tedious otherwise.

 

Thanks for the help, amnd sorry if this question seems rather elementary, I haven't used LabView much until last week.

0 Kudos
Message 1 of 6
(2,650 Views)

The thing here is the stop button for the stage control is been placed in the last stage (case 7) and hence program goes through all the sequences.

 

To stop abruptly place the stop control outside the Stacked Sequence.

 

Hope this is what you wanted

0 Kudos
Message 2 of 6
(2,646 Views)
Solution
Accepted by topic author AsianChef

This is one of the reasons stacked sequences should be avoided at any cost!   They can ALWAYS be replaced by a state machine with several advantages.  Number 1 among the advantages of replacing a stacked sequence with a state machine is the ability to STOP between state transitions while a stacked sequence must complete every frame before it exits.

 

 


"Should be" isn't "Is" -Jay
Message 3 of 6
(2,645 Views)

As parlayed in my intro (I think and hope) I have only managed to stop the stages by placing the stop control inside the last slide. Otherwise, even with the control outside the sequence, it will simply continue to run. I guess I'll look at the state machines. Thanks though.

 

As to state machine, I guess I'll need to take a gander. Thanks for that.

0 Kudos
Message 4 of 6
(2,641 Views)

@cancancanopen wrote:

The thing here is the stop button for the stage control is been placed in the last stage (case 7) and hence program goes through all the sequences.

 

To stop abruptly place the stop control outside the Stacked Sequence.

 

Hope this is what you wanted


?????

 

That's even worse than what he has now!

 

If you place the stop control outside the stacked sequence, in all likelihood it will get read before the stacked sequence even begins.  So if the program is in frame 4 when you hit the stop button, not only will the control not be read and still continue through the last frame, it won't be read until the loop iterates again, at which time the stacked sequence will start all over again because all code in a loop must complete before the loop iteration is complete.

 

I don't think you really wanted to tell AsianChef to do that.

 

As Jeff said, the only proper way of doing this is to eliminate the sequences, and set the architecture up to be a state machine.

Message 5 of 6
(2,634 Views)

Good catch extremely sorry for not analysing that. Sorry for taking Mr.AsianChef on wrong path.

 

I completely agree what others said.

0 Kudos
Message 6 of 6
(2,612 Views)