LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stopping a timed loop from an event structure with multiple events. Why can't I make this work?

I have attached a small file (lv 8.0).  Stopping the timed loop works fine until I add other events to the event structure.  In the attached file the program ends when the stop button is pressed but  if I add the OK button and click it first the vi will not work.  It recognizes the OK button change but from then on the my event structure does not execute.  I believe I have done this in the past but I just can't seem to work out my problem here.  Thanks for any pointers.


Message Edited by mike72903 on 01-08-2008 05:00 PM
0 Kudos
Message 1 of 6
(2,639 Views)

Don't put the timed while loop and the event structure in the same overall while loop.  What happens is that when you execute the OK, the event structure fires and basically ends.  The timed loop is still running up top.  You won't get around to the event structure for it to sit and wait for any more events until the overall while loop stops, and that won't happen until the timed loop stops.

So you have a catch 22, you need the stop button to stop the top loop, but the stop button won't do anything until the top loop ends and the overall loop comes back around to the event structure again.Smiley Wink

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

Try this.  I suspect you were killing the other thread before the abort command could be sent.

 

Matthew Fitzsimons

Certified LabVIEW Architect
LabVIEW 6.1 ... 2013, LVOOP, GOOP, TestStand, DAQ, and Vison
0 Kudos
Message 3 of 6
(2,633 Views)

Matt,

Your solution doesn't work either.  It looks like you wait statement in the one event.  The problem is still what I stated in reply #2.  (But I see you posted your reply at almost the same time as I posted mine.):smileywink:

The attached works.



Message Edited by Ravens Fan on 01-08-2008 07:29 PM
Message 4 of 6
(2,624 Views)
Ravens answer should get you going. 🙂
 
The issue is dataflow, and it seems  you have some general misconceptions.
 
In your original VI, the big loop cannot go to the next iteration until all code in it has finished. Since your timed loop never finishes, your event structure only gets one shot. A good tool to see what is going on is execution highlighting. Try it!
 
What is the purpose of the small sequence frame surrounding the "stop timed loop" function? Again it almost seems you are trying to make sure the loop stops before the event finishes. This is not needed. The event cannot finish until all code in it has finished so the sequence is completely irrelevant codewise.
 
Your timeout case is unused.
 
Still, can you tell us a little bit more about your application? What else is there in your real code? Do you need to stop multiple timed loops? If not, just place the stop button terminal in the timed loop and forget about all the rest.
 
Message 5 of 6
(2,614 Views)
Thanks everyone.  I knew it was somehow dataflow but it was late and I was frustratedSmiley Mad because I knew I had done this before somehow.  Ravens Fan thanks for the solution you posted.  Altenbach, the sequence structure was just accidently left after removing other code to get back to the most simple example.
Thanks again, Mike
0 Kudos
Message 6 of 6
(2,593 Views)