From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a "Start" button


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
Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

0 Kudos
Message 11 of 16
(1,492 Views)

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. 

 

Message 12 of 16
(1,483 Views)

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 🙂

0 Kudos
Message 13 of 16
(1,479 Views)

JKI State Machine to the rescue...  It's worth installing VIPM and this package.

 

StartStop.jpg

Jim
You're entirely bonkers. But I'll tell you a secret. All the best people are. ~ Alice
For he does not know what will happen; So who can tell him when it will occur? Eccl. 8:7

Message 14 of 16
(1,460 Views)
What about a state machine in the timeout case of an event structure? Then have an event that reads a value change in the start/stop value. If its true, go to the precalc state, if its false go to the exit state. See the attached VI. I would post an image but I don't wanna post one for each state.
Message 15 of 16
(1,447 Views)

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

 

 

0 Kudos
Message 16 of 16
(1,410 Views)