I have tried to add a "start" button to my VI without much success. I'm using LabView 8.5.1.
Currently, my VI is configured as follows:
I have a flat sequence structure with three "frames". The first two prompt the user for a filename and a location to save a log file to (these are in separate "frames") and configure the log file accordingly. The third frame is the bulk of the programme, running within a While loop.
I would ideally like a "Start" button that doubles up as a Stop button and stops the While loop from executing when pressed (and obviously, initiates the whole VI when it is a Start button!).
I have tried creating an "OK' button on the front panel, wiring this to the "enable" input of the "Enter Filename" block and also taking the wire outside the sequence structure, passing it through a "Not" block and re-entering into the sequence and while loop and terminating in the "stop if true" block within the while loop. However, whenever I run the VI within the developer environment by clicking the "Run" arrow, it instantly jumps to the "choose file path" dialogue, in the second frame, irrespective of the status of the Start/Stop button.
I hope this is clear enough. If you don't understand what i'm asking, please post and I'll attempt to clarify!
Thanks for the help 🙂
Seems to some basic stuff!!! but made complex by your explanation...
Just post the vi forum will solve it.
For that u need to change the architecture to State machine to contol ur states.
ur flat sequence executes ur code sequentially u cant stop ur programme middle of the execution.
The switch mechanical action is "Switch When Pressed" to give you the Start/Stop action. The loop will stop when the stop button goes from True to False. You'd put your code in the True case of the Case Structure and leave the False case empty and Bob will be your uncle. You'll need to add something to make sure that the button is off when the VI starts (perhaps an Invoke Node at the beginning or end).
Get rid of the Stacked Structure and use either a State Machine or an Event Structure (better) as proposed earlier.
You can use the same button for Start / Stop. Simply wire boolean output to a shift register and use a NAND (AND + invert) to alternate the output.
Get rid of the Stacked Structure
I think it is the Flat Seq Struct, Ray...
Old age has affected my eyesight.. Oops.. Well being 1/2 blind doesn't help 😄 I should change my avatar (again)
Thanks Partha.. 😉
I tried jcarmody's suggestion but unfortunately it didn't work. I've attached the basic layout of my VI (it's very complex so have left everything out of the inner loops). Half of the method works fine, as in the VI doesn't start until I click the "Start" button, but when I click the button again, it doesn't stop the script. I'd guess the problem is something to do with how I've wired everything up to the inner While loop.
If anyone could shed some light on this it'd be much appreciated 🙂