LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

event structure and while loop general stop

Sorry but how do I make a general stop for this kind of structure?

0 Kudos
Message 1 of 10
(4,259 Views)

Please attach the VI in 2011 version.

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 10
(4,252 Views)

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:

 

    1. Right Click your event structure
    2. "Edit Events handled by this case"
    3. Uncheck "Lock Panel (defer processing of user actions) until the case for this event completes.

- 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".

Regards,
Ben C
---

---
0 Kudos
Message 3 of 10
(4,236 Views)

saved in labview 2011

0 Kudos
Message 4 of 10
(4,226 Views)

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.

0 Kudos
Message 5 of 10
(4,209 Views)

As has been mentioned, you code is not great.

 

  • Your event is set to lock the front panel until the event completes, but the event cannot complete unless the stop button is pressed. You have a deadlock.
  • What is the purpose of the sequence frame? You code is not even inside the frame but floating over it
  • Do not place interactive code inside event cases. Use the outer loop if you need to spin. (see attacched modification)
  • If you don't use the timeout case, it should not be there
  • Latch action terminals belong inside their event case.
  • You don't need a wait in parallel to an event structure
  • Your numeric wired to the outer iteration terminal will not show anything interesting most of the time.
  • ....

I would recommend you start with a few tutorials

0 Kudos
Message 6 of 10
(4,202 Views)

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.

Randall Pursley
0 Kudos
Message 7 of 10
(4,198 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 8 of 10
(4,177 Views)

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.

 

0 Kudos
Message 9 of 10
(4,156 Views)

@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. 😄

0 Kudos
Message 10 of 10
(4,153 Views)