LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to loop through a while loop several more times after the stop button is pressed

I have an application which runs a while loop that checks the state of controls, calls a logic subVI, and gets results from that subVI to set some indicators. The controls and outputs from the logic subVI both go through some display logic subVI's, so I have to use some shift registers to avoid loops.

The logic subVI is used to control some hardware devices. When I exit my program, by pressing the stop button to break out of the loop, I want to set all of my controls to default values, and I want tq make sure that this gets communicated to the hardware before the program exits. So what I want to do is set all controls to default when the stop button is pressed, and then let my while loop run twice more before exiting. I'm looking for suggestions on the best way to do this.
0 Kudos
Message 1 of 9
(3,574 Views)
I am sure there are more efficient ways but here is a quick solution. I am not sure whether you like feedback nodes or shift registers better.
Message 2 of 9
(3,564 Views)
I'm not sure why you need to execute the while loop a couple of times after pressing the stop. Your stop button should be handled by an event structure. When a value change event is detected, simply have the default hardware writes inside the event. Set the controls to their defaults with an invoke node and use the method Reinitialize All To Default.
0 Kudos
Message 3 of 9
(3,559 Views)
perfect, that's what I was looking for.

I'd forgotten about the little i that gave the loop iteration 😛

Message Edited by holomorph on 04-26-2005 02:20 PM

0 Kudos
Message 4 of 9
(3,556 Views)
Here's another way if you don't have the event structure.
0 Kudos
Message 5 of 9
(3,553 Views)
perfect, that's what I was looking for.

I'd forgotten about the little i that gave the loop iteration 😛

Message Edited by holomorph on 04-26-2005 02:14 PM

0 Kudos
Message 6 of 9
(3,552 Views)
hmm, no way to delete posts, that's kinda lame.

Message Edited by holomorph on 04-26-2005 02:15 PM

0 Kudos
Message 7 of 9
(3,551 Views)
I don't really understand how this one works, what is going on on the left there?

Message Edited by holomorph on 04-26-2005 02:25 PM

0 Kudos
Message 8 of 9
(3,543 Views)
On the left of Dennis's example is a stacked shift register (For details, see chapter 8 of the LabVIEW User Manual). Each additional element goes back one more iteration in history.

You could simplify it even more by using a latch boolean and only tapping into the lowest shifter. See attached example (LabVIEW 7.0)
0 Kudos
Message 9 of 9
(3,516 Views)