04-02-2010 03:13 AM
hello
I had a question about Run button.Can we add the Run button on the front panel instead of tool bar. if yes how it is possible, any settings or any programming is needed for this? Help me with solution. This is becuse some of our clients are not friendly with Lab View and also it is better anyone to run the program.
Thank you
04-02-2010 05:12 AM
04-02-2010 05:27 AM
04-02-2010 11:37 AM
Hello
Thanks for responding
RUN when opened is OK fine. But it is to be controlled like shown in fig. Whenever we need then only it will opened otherwise time delay will add in front of the program, isn't it?
04-02-2010 12:01 PM
What?
04-02-2010 12:02 PM
If you use run when opened, the VI will start running as soon as you open it. There is no run button to press. If you want a user to press a run button on the front panel as you show, you have to create a while loop to read the button. When button is presssed, exit loop and continue with code. You must have the wire from the loop to the rest of code structure. It can be any wire. This will prevent the code from running until the loop is done. Be sure to add the delay in the loop to prevent using 100% CPU time while waiting for the user to press the RUN button (OK Button). You still have to set the vi to Run When Opened.
04-02-2010 01:15 PM
tbob wrote:If you use run when opened, the VI will start running as soon as you open it. There is no run button to press. If you want a user to press a run button on the front panel as you show, you have to create a while loop to read the button. When button is presssed, exit loop and continue with code. You must have the wire from the loop to the rest of code structure. It can be any wire. This will prevent the code from running until the loop is done. Be sure to add the delay in the loop to prevent using 100% CPU time while waiting for the user to press the RUN button (OK Button). You still have to set the vi to Run When Opened.
The user says (in comments on front panel) he will have it show as "stop" after it's started. I'm assuming that means this is a boolean button for start and stop of the VI. It wont just start-> execute-> end. It will continue executing until ended. If the idea above is used, then you will end up using locals to stop because there will probably be another while loop where the flat sequence is. I have a feeling the architecture in general of the block diagram is bad and the OP may want to post his code.
04-02-2010 04:34 PM
Once again, it's not local variables that are bad, it's the improper use of local variables that is bad. There is nothing wrong with using a local in this case. The local is not being written to, it is just being read. The architecture is fine, although I wouldn't put a run button on a vi that is set to run when opened. But maybe the user would like to have an opportunity to set front panel controls before running. Then a run button is fine. Also, this is not the architecture to use if the user wants to run-stop-run again - stop again, etc. Once stopped, the vi is completely stopped. (Could not use a snippit because of the property node. Snippit doesn't like those)