09-17-2010 06:19 PM
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.
Solved! Go to Solution.
09-17-2010 06:31 PM
Use a while loop to poll an OK button. If false, do nothing. If true, run your code. See the picture below:
The real code won't run until you press OK. When done, the loop will stop.
09-22-2010 04:18 PM
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
09-22-2010 04:40 PM - edited 09-22-2010 04:46 PM
You have to put it INSIDE the loop.
EDIT: I mean the case structure.
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.
09-22-2010 04:50 PM
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.
09-22-2010 05:05 PM
Hi tbob/NIquist,
Is this what you mean? I still can't enable the output.
Thanks
Aaron
09-22-2010 05:15 PM
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.
09-22-2010 05:17 PM
@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???
09-22-2010 05:28 PM
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
09-22-2010 05:42 PM
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.