LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

To create RUN Button/Option to run my application

Hi All,
I need help to create a substitute RUN Button on to my application instaed of RUN button on the toolbar such that when I press/select it the application should start executing without the actual RUN button being pressed. Is there any solution to this problem If NO what is the nearest/approximate solution such that the behavior of my application appears similar.
I also would like to know how the front panel of a VI looks as i have not yet worked on application builder/Run time engine 7.0
I'm using LabVIEW 7.0.
Thanks in advance
0 Kudos
Message 1 of 6
(3,883 Views)
There are three ways to run a VI:

1: Interactive by loading it with File>>Open and starting with the Run button or CTLR+R.

2: Set the VI Property>>Execution>>Run when opened flag to let the VI run each time when the VI opens its front panel. The top level VI does this by default. Look at this thread for using this option together with the Exit LabVIEW function.

3: Programmatic using Open VI reference and the Run VI Invoke Node.

If you plan to build an application which has no toolbar and a custom menu bar the top level VI will always start. The application builder will set the property from 2: automatically and the runtime will open the front panel of the top level VI. This causes it to run immediately.

The front panels of an application look the same as in the development environment when the VI is running. Operate>>change to run mode or CTRL+M let you show the front panel in the development environment how it would look when it is running without executing the VI.

Message Edited by waldemar.hersacher on 05-24-2005 12:54 PM

Waldemar

Using 7.1.1, 8.5.1, 8.6.1, 2009 on XP and RT
Don't forget to give Kudos to good answers and/or questions
Message 2 of 6
(3,877 Views)
Here's a slightly different approach.

Place an Event structure before your main application loop and connect some data from within the Event structure to your main application loop. Configure the event structure to watch for your custom Run button. The main loop will have to wait until the Event fires from the Run button before it can start.

The attached example shows how to set this up. It's set to Run when Opened from VI Properties>Execution". When you open it, it will be running, but nothing will happen until you click the Start button. Note after you click the Start button, the loop counter starts incrementing.

Using this method basically puts your application to sleep until the Start button is clicked.

Now, take this one step further. Put a While loop around the Event structure and the main application loop. So now when you stop the main application loop, it goes back and waits for the user to press the Start button again.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 3 of 6
(3,865 Views)
Thanks,
It worked perfectly for my case,I could play around with start & stop buttons.But Is there any option to stop the VI, always running VI in this case to stop programatically without pressing the Abort Execution button. As the Custom Run button.vi stops only by pressing Abort Execution button.
Thanks Once again
0 Kudos
Message 4 of 6
(3,851 Views)
Thanks,
It worked perfectly for my case,I could play around with start & stop buttons.But Is there any option to stop the VI, always running VI in this case to stop programatically without pressing the Abort Execution button. As the Custom Run button.vi stops only by pressing Abort Execution button.
Thanks Once again
0 Kudos
Message 5 of 6
(3,851 Views)
Sorry about that. Slight oversight on my part.

What you'll need to do is have the Event structure watch for the click of the Stop button as well.

To do this, right click on the Event structure and select, "Add Event Case..". In the dialog that opens, select the 'Stop' entry in th elower left section where it lists all the controls/indicators. After that is selected, the lower right section will populate with several selections. Scroll down in this list and select "Value Change". Hit OK and the Event structure will also fire when you click the Stop button so the loop will start, but stop right away since the button was pressed.

This will however cause all the code in the loop to run once. If you don't want that to happen, yo ucould place a Case structure in the loop and control it from your Start button with all your code in the True case. This is a very simple way to handle this. A bit complex, but a lot more flexible would to use a State machine with an Event structure in an 'Idle' case.

Ed


Ed Dickens - Certified LabVIEW Architect - DISTek Integration, Inc. - NI Certified Alliance Partner
Using the Abort button to stop your VI is like using a tree to stop your car. It works, but there may be consequences.
0 Kudos
Message 6 of 6
(3,838 Views)