Paul Posted July 14, 2004 Report Share Posted July 14, 2004 I have a button wired to a case structure. The button is inside a while loop that runs until the button is pushed. When the button is pushed it sends a true command to the case structure that then executes a series of long and complicated commands. What I want to do is wire another button that would stop the case structure from continuing to execute as soon as the user clicks on the second button. I have tried several different ways to do this with no apprent luck. In a nutt shell I am looking for a user control that would stop a case structure in the middle of execution. As always, all ideas are welcome. Quote Link to comment
Michael Aivaliotis Posted July 14, 2004 Report Share Posted July 14, 2004 What I want to do is wire another button that would stop the case structure from continuing to execute as soon as the user clicks on the second button. I have tried several different ways to do this with no apprent luck. In a nutt shell I am looking for a user control that would stop a case structure in the middle of execution. 1155[/snapback] You cannot abort a process this way because you have not programmed any modularity in your code. The only way to do this is to put case structures around the bits of code that you need to abort and then make those cases false when you hit stop. For example, if you have three VI's that have to execute and you are executing VI#1 then you can ignore VI#2 and #3. However you cannot abort VI#1 until it has finished executing. If you need this type of control I recommend using state machine architecture and break down your code into smaller chunks that can be controlled better. Here is the FAQ entry: What is a State Machine If you want to do simple start and stop button behavior, look at the attached example (LV70) Download File:post-2-1089822983.vi Quote Link to comment
Paul Posted July 15, 2004 Author Report Share Posted July 15, 2004 Mr. Aivialotis, This is the third time that you have saved my behind. Many thanks, beyond expression. I guess Greeks and Russians can relate to one another best. Thanks again for all of your help and no offense inteded but hopefully I wont be needing it again. I am almost done with this particular program, and hopefully I can finish it up without any additional help. Thank you so much. Paul Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.