05-26-2009 12:57 PM - edited 05-26-2009 12:57 PM
thomas_p wrote:Hi,
I tried jcarmody's suggestion but unfortunately it didn't work.
I resemble that remark!
05-26-2009 01:03 PM
jcarmody wrote:
thomas_p wrote:Hi,
I tried jcarmody's suggestion but unfortunately it didn't work.
I resemble that remark!
Message Edited by jcarmody on 05-26-2009 12:57 PM
Hi,
It only "half worked" - the behaviour on starting the VI was exactly as I wanted, but unfortunately when clicking the "start" button a second time, it failed to stop the inner while loop and the VI as a whole. The inner loop just kept on running.
Thanks for the help.
05-26-2009 01:19 PM
Hi all,
I've managed to get a method that works by using two buttons - one for start (based on jcarmody's method) and one for stop. Thanks for all the help 🙂
05-26-2009 02:23 PM
05-26-2009 05:50 PM
05-27-2009 12:04 PM
no...no...no!...
Don't complicate things. The timeout event if for timeouts.. Don't do it that way.
If you're going to do things right, let's propose the right way of doing things.
If you want to use an Event Structure and a State Machine, then use the model from the Event with Data. A shell / template of this architecture can be found under File > New > From Template > Design Patterns > Producer/Consumer Design Patter (Events).
The idea is that everytime you click on the Start/Stop button, an event is detected. It sends the information via a notifier or a queue to the consumer loop (State Machine) that looks at the last boolean value and inverts it to select the appropriate next state (ie: run / stop or anything else it should do based on allowed events). This method will be scalable and will work with whatever you want that button to do.
When it is stopped, it does not have to exit the software, unless you want it to. It could go into a state that waits for the event. That's where the timeout event will be useful, to generate a queued message saying something like "keep doing what you just did, there's no change", and the consumer loop will continue doing it's thing. You'll have to be careful with timing in order to synchronize the two. However, this can also be simplified.
If needed, I can do a quick example of what I mean. I simply need access to a PC that has LabVIEW installed. It's not installed on this machine.
R