LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to run my vi from a front panel control without using even structure in the vi

Hello, I would like to run my vi from a front pannel control instead of the tool bar RUN botton. I am using LV6.1 without the even structure feature, so I can't do as proposed by a previous posting by setting the vi to run at open in a "do nothing state" then taking the front panel control event and switching the vi into another ("running") state. I wonder is there some other type of solutions to this problem. Your help is greatly appreciated.

Bryan
0 Kudos
Message 1 of 13
(3,066 Views)
You'll still have to set your VI to run when opened. The only other thing you need to do is put in a while loop that executes before the main body of your program. Put your "Start" button inside the while loop and have that terminate the loop. Make sure you have some data flow from the while loop to your main program so that the start while loop will execute first. If the main body of code is not enclosed by an existing structure (i.e. while loop, for loop), you could put a sequence structure around it.
0 Kudos
Message 2 of 13
(3,057 Views)
Hi Dennis, thank you for the reply. I tried with the attached vi. It can only run once (also not in the correct state I want), as the control i placed on the front pannel will stop the VI. I want to have the vi do nothing when it is opened and start counting when the start botton is pressed. Then i want it stop counting when the botton is pressed again...and so on... I must need a different structure to get it work, or did I miss something simple? Thanks again.
0 Kudos
Message 3 of 13
(3,049 Views)
Your stop condition probably should be "Stop if true"

As attached. The first sequence while run in the loop you wrote. When the user presses the start button your program will run.

Hopefully 🙂
0 Kudos
Message 4 of 13
(3,042 Views)
>> The first sequence while run in the loop you wrote.

Sorry that was meant to be: in the first sequence frame the "while" loop that you wrote will continuously run until the user presses start. The program then moves to the second frame where the main program will run.

Hope this makes more sense

Still haven't had that first coffee yet 🙂
0 Kudos
Message 5 of 13
(3,039 Views)
I think we got it work half way...but the control botton can't stop the "main program" (frame 2), and it cannot restart the program if pressed again. (I dont want to use the RUN botton in the tool bar at all in the whole sequence).

Latte is not strong enough 🙂
0 Kudos
Message 6 of 13
(3,035 Views)
sorry forgot to attach...
0 Kudos
Message 7 of 13
(3,031 Views)
As the start button is outside the second loop it never gets queried. I added a local variable to aid this. To make it run multiple times you can make the vi run continuously (I'm not sure if you can make it run continuously when opened though)

Yan
0 Kudos
Message 8 of 13
(3,022 Views)
Hi Yan, thank for the input. That definitely solved one of the problems. I made the main program into a finite loop instead of running continuesly. I guess we still need to move the sequence structure into the while loop, otherwise after sequence 2, the VI will stop, i.e. exiting the running mode, which is not what i desired. I would like to have the front panel control button "start" the code in the sequence 2.

Bryan.
0 Kudos
Message 9 of 13
(3,015 Views)

i have two event structure cases. 1. if button1 is pressed then open vi1 2. if button2 is pressed open vi2. am unable to run both the VIs simulateniously. i.e if i click bitton1. vi one gets open but wiithout closing vi1 if i press button2 VI2 doesnt get called and openned. please provide me the solution. project is attached here.

0 Kudos
Message 10 of 13
(2,454 Views)