10-23-2014 08:17 AM
Sorry but how do I make a general stop for this kind of structure?
10-23-2014 08:23 AM
Please attach the VI in 2011 version.
10-23-2014 08:55 AM
There are a couple of issues with the code which will stop it from running as you'd expect.
- Generally, your "Start" button needs to be placed inside of the event stucture, since it's a "latch" button, it will only "unpress" when it's read by LabVIEW, it needs to be inside the event structure so that the button is read as soon as you have pressed it.
- You have your event structure set to lock all of your front panel controls until the code inside it has completed running, since you can only break out of the structure by pressing the "Stop" button you'll never be able to break out of the loop: To change this feature try the following:
- Your stop button will only function as a stop button after the user has pressed "start", this is because the event case for pressing "stop" leaves the wire connected to the stop button as default (which is false for boolean logic). I would advise against using the "Use default if unwired" setting for structure connections as it means you have not explicitly told the program what should happen in each case. In the start case, I would wire the connector to the stop function as "false", and in the stop case I would wire "true".
10-23-2014 09:06 AM
saved in labview 2011
10-23-2014 09:32 AM
Hi Clark,
I seem not to have it right. I tried to increase my timer to see when the program stops after pressing STOP, it looks like it is not stopping right away, and not even working sometimes. Any further help?
Thank you.
10-23-2014 09:44 AM - edited 10-23-2014 09:52 AM
As has been mentioned, you code is not great.
I would recommend you start with a few tutorials
10-23-2014 09:46 AM
Take a look at this. Is this what you are trying to do? The Start button starts it immediately and the Stop button stops it immediately.
10-23-2014 11:10 AM
So you want to press the Start Button and then have your program run off and do something. But then you want to hit the Stop button to make it stop. Sounds like you should look into making a State Machine. You can can a single state called "Idle" in which you use the Event Structure to check for the button presses and react accordingly. Just make sure your state machine is going to that state every so often.
10-23-2014 02:24 PM
My real problem here is that outside my event structure I have a while loop and inside my event structure I have a case structure which has another while loop in it. How to make a general stop for this, which should stop both while loop.
Thanks for any help.
10-23-2014 02:30 PM
@agyna wrote:
My real problem here is that outside my event structure I have a while loop and inside my event structure I have a case structure which has another while loop in it.
The real problem is that you arcitected it in this convoluted way. Make it a nice state machine with clear flow and everything should fall into place. 😄