Here, in my pc, stop button 2 is not working.
I think it should stop the program. Am I right?
of course this is just an example, I'm having a problem in another vi, but is too big to post here, so I made this one just to show you guys.
thank you very much.
the vi is attached.
Solved! Go to Solution.
hey looked at ur VI and it is pretty simple. if you right click on the T/F button on the back page and go down to properties then go to operation tab and select Switch when pressed this will get you the effect you want. You can also right click the button on the front page and go down to mechanical action and select Switch when pressed, this is the top left corner box.
The mechanical action being set for Switch Until Released as jaswri stated is definitely a major part of your problem.
I know this is just a quick dirty VI, but in general having to use multiple stop buttons to get out of a program is very user unfriendly. The user has to know to hit Stop 2, then Stop 1 in order to end. But that highlights a problem. The Stop 1 button is read as soon as the VI starts, which means it is False. So if you hit Stop 2, then hit stop 1, the inner while loop will stop, but the outer while loop will iterate again because the button has already been read. The new True state won't be read until the outer while loop has restarted, at which time the inner while loop will start again.
So right now, in order to end your program, you have to hit Stop 2, then Stop, then Stop again to get both while loops to stop.
Put a wait statement in the inner loop with a 100 msec constant. Put indicators on the i terminals of both while loops. Run your VI and watch the behavior. Also, turn on execution highlighting and you'll see even more clearly what is happening.
lol I agree with Raven Fan. I was not sure how acurate your example VI is to your real program. But I agree this is not the best method to controlling this. The only suggestion that I may give diffrent to Raven Fan would be to use notifiers instead of a wait action.