LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Run Button without execute the program

Solved!
Go to solution

Hi,

 

Normally, when I am pressing the "run button", it will run the program. How do I prevent from executing the program until I want to enable? For example, I have 3 power supplies on my pxi box, and I don't want to run the program until I have all my value set: voltage, current limit, output function and etc...Then, I will press the button like (enable or set) to set a certain voltage at certain power supply. I am using Labview 8.6. Thank you.

0 Kudos
Message 1 of 32
(3,884 Views)

Use a while loop to poll an OK button.  If false, do nothing.  If true, run your code.  See the picture below:

 

24236iDD82E97E57D2839DThe real code won't run until you press OK.  When done, the loop will stop.

- tbob

Inventor of the WORM Global
Message 2 of 32
(3,872 Views)

Hi Bob,

 

I tried to implement as your suggestion when I choose the value and pressed the "set button". Nothing is happening. Can you please help take a look? Thank you for helping.

 

Aaron

0 Kudos
Message 3 of 32
(3,819 Views)

You have to put it INSIDE the loop.

 

EDIT:  I mean the case structure. Smiley Surprised

 

EDIT AGAIN:  Now, it still won't wait for you to press it if that's what you're expecting.  As soon as a node recieves all its inputs it will execute.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 4 of 32
(3,805 Views)

Besides moving the button inside the loop, add a delay, Wait(ms), to the loop, outside of the case structure.  This prevents 100% CPU usage.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 5 of 32
(3,792 Views)

Hi tbob/NIquist,

 

Is this what you mean? I still can't enable the output.

 

Thanks

Aaron

 

 

0 Kudos
Message 6 of 32
(3,780 Views)

Are you creating an executable set to Run When Opened or something?  Right now your program will start and the loop will spin as fast as it can (as tbob said, put in a small delay), then when you press start it will run once more and stop.  There's no point to the START button.  It just makes you click twice to do the same thing as clicking the run arrow once.

 

Are you trying to do this?:  

 

1.  Run the VI

2.  Set some parameters

3.  Enable the output (and start measuring)

4.  Stop the measurement

5.  THEN start again with the setting parameters part without ever stopping the VI.

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 7 of 32
(3,770 Views)

 


@caahsc wrote:

Hi tbob/NIquist,

 

Is this what you mean? I still can't enable the output.

 

Thanks

Aaron

 

 


Ummmm, no.  Is what you want what I described in my last post???

 

LabVIEW Pro Dev & Measurement Studio Pro (VS Pro) 2019
0 Kudos
Message 8 of 32
(3,769 Views)

Hi NIquist,

 

By pressing the "White Arrow Run Button", the program will be executed. So I want to set the parameters before it can execute. Here is what I am trying to do.

 

 

1.  Run the VI (without execute the program)

2.  Set some parameters power supply 1

3.  Enable the output channel 0 for ps1 then if I want to set different power supply 2.

4.  reselect the parameter again for ps2

5.  Enable the output let say channel 1 for ps2

 

Aaron

0 Kudos
Message 9 of 32
(3,756 Views)

Move the Set button outside that inner loop.  It should be inside the True case but not inside the inner loop.

To run it again for another power supply, you need to control the outer loop with a separate stop button.  Remove the boolean constants from the True and False cases that are wired to the stop sign.  Wire the new stop button to the stop sign.  When you are done setting all power supplies, press the new stop button.

If you know you will only be using two power supplies, you could replace the outer while loop with a For loop with a constant value of 2 wired to the N.  Then the loop will execute for the first power supply setting and then repeat for the next.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 10 of 32
(3,748 Views)