LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Use one button to run/stop program

Solved!
Go to solution

Hello forum,

 

I have a program that when executed, asks for he username, then monitors 4 individual inputs. When the STOP button is pressed, the file is saved. This part of the code works well.

I am trying to modify the code so instead of asking for the username when executed, the user has to press the RUN button (same button as STOP), then execute the code as normal.

When the user presses the STOP button, the button will change back to RUN and wait for the next time it is pressed. Any help will be greatly appreciated.

0 Kudos
Message 1 of 5
(4,048 Views)

I can't view your code as it is a later version, so if you could save for an earlier version or post a snippet that would be helpful.

 

But what you want is very possible, Either simply through the use of button that when in the true state enables the program to run and in the false state returns to the waiting state, using feedback node it could possible to compare the current and past state to spot changes and trigger your initialisation and saving of the data.

0 Kudos
Message 2 of 5
(4,041 Views)

I saved it for Ver 10.0.

0 Kudos
Message 3 of 5
(4,021 Views)
Solution
Accepted by topic author hvazquez

there is several trick for that

this vi is one of that 

also some part of your code need to be fix 

to work well I cry to correct some part of them

but you have to work on agian too

best regard,

Hatef

Message 4 of 5
(3,990 Views)

@hvazquez wrote:

Hello forum,

 

I have a program that when executed, asks for he username, then monitors 4 individual inputs. When the STOP button is pressed, the file is saved. This part of the code works well.

I am trying to modify the code so instead of asking for the username when executed, the user has to press the RUN button (same button as STOP), then execute the code as normal.

When the user presses the STOP button, the button will change back to RUN and wait for the next time it is pressed. Any help will be greatly appreciated.


OK, you missed a few things in that code.

FIRST:

Capture.PNG

you have an "Infinate Loop"  There is no way for that "FALSE" Constant to become True and stop the loop so, the DAQ Assistant Data is just going to accumulate on the Shift Register (Get this!) the data on the SR is not used!  Since, the loop cannot be stopped anyway, what is the point of the down-stream loop?  Trying to write the last string of data to a file that cannot be accessed? he second loop cannot start until the first loop (that cannot be stopped stops.)

 

What is going on with the "boolean data" on the feed back node?--- I could use a paragraph on how that ?1-0 (Coerced to array of I32 from four bools ) is supposed to work.  

 

Your code makes little sence untill you tell us what you want it to do---- 

 

LabVIEW is a "Dataflow paradigm" language.  Structures cannot run until all of their inputs are ready.  Structures may run (in any order) when all of the inputs are ready..Nothing outputs anything until all processes are completed.  Dataflow 101

 

OR, stated otherwise- you have confused the functions of Shift Registers and an Auto indexing Tunnels and, I won't mention the local variable abuse-  You might want to go through the LabVIEW toutorials again or edit the self-paced online CORE I class


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 5
(3,963 Views)