LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

stop vi with two controls

Hi,

    I've two buttons on the front panel.one is "PUSH Button" and the other is "STOP button"(while loop).Initially,push button will be in off state.The VI will run using RUN button. but the measurement starts only when the push button is clicked(true)(after the vi starts running).Again,in between measurement,if we make the boolean value of  push button false, the program has to stop.Also if press the stop button the program has to stop.i.e if either of the buttons(push or stop) is pressed, the program has to stop.I'm using case structure to do this.But the problem is, as initially push button will be in off state, the program is stopped with out executing the code.How ca I solve this

 

Regards
RobinHood
0 Kudos
Message 1 of 21
(3,332 Views)
It's very simple. Just post your code.
0 Kudos
Message 2 of 21
(3,331 Views)
Thanks Mathan, see the attached code
Regards
RobinHood
0 Kudos
Message 3 of 21
(3,328 Views)

You could store in a shift register whether the push button has ever been true.  (Value from left hand SR ORed with button goes into right hand shift register).  Now if you read the value out of the left hand shift register And the button is False, then you can OR that with the other stop button going into the stop terminal.

 

Message Edited by Ravens Fan on 03-11-2010 01:05 AM
0 Kudos
Message 4 of 21
(3,325 Views)

hey Robin,

 

I guess there were lots of suggestion and pieces of code that asked you to implement the same using the event structure.

 

Why you ended up coding using a while loop and a case structutre?

 

 

Guru

Regards
Guru (CLA)
0 Kudos
Message 5 of 21
(3,319 Views)
Thanks Guru,I have done it using event structures also.
Regards
RobinHood
0 Kudos
Message 6 of 21
(3,317 Views)

Ravens,

            This is not what I wanted.Initially,the push button will be in OFF state.Once the vi runs using RUN button, the measurement starts only after we make the push button glow.Thereafter,if we make it false or if we press the stop button the vi has to stop running.but in your code, the doesn't stop running even if we make the push button false.

Regards
RobinHood
0 Kudos
Message 7 of 21
(3,310 Views)

You create a local variable for this push button and wire a value of false outside the while loop.(to the code given by Raven)

 

So when you hit the RUN button, the Push button will heave a value of false always..

 

Guru

Regards
Guru (CLA)
0 Kudos
Message 8 of 21
(3,307 Views)

ok guru,

             In the same code, the seconds column is not running once we check VPA/UPA/Test with user defined values.why is it so

Message Edited by Robin Hood on 03-11-2010 01:29 AM
Regards
RobinHood
0 Kudos
Message 9 of 21
(3,300 Views)
its becasue the control is outside the while loop..Put it inside...
Regards
Guru (CLA)
0 Kudos
Message 10 of 21
(3,271 Views)