LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to run VI using bolean control?

How to run VI using bolean control? Do I need to use invoke node or something else?

Thank you in advance.
0 Kudos
Message 1 of 8
(2,675 Views)
Do you mean you want to start the execution when a user clicks something like a Start button? If so, put the control in a while loop with the control wired to the Stop sign in the loop. Be sure to put a time delay also. When the user clicks the start button, the loop will stop. Be sure to wire something out of the loop into the beginning of your code, like Error In or Error Out. When the loop stops, the rest of the code will start executing.
- tbob

Inventor of the WORM Global
Message 2 of 8
(2,662 Views)
I'm sorry.I didn't formulate my question correctly. I need to start running VI using some other button exept standart Run or continuosly Run button at the top of the front panel. I mean, can I start VI execution in some other way, for example in my case, I need to start it with bolean control, without using Run button. I read that it can be done using invoke node, but i have problems with that.Maby you could help.

Thank you.
0 Kudos
Message 3 of 8
(2,641 Views)
You cannot start running a vi using a boolean on the front panel of that same VI. Detecting the state of the control requires the VI to be running.

Maybe you can clarify WHY you need to do this. The run button is for VI development. Once you have a final application, it should be set to "run when opened". The actual code could start out in a wait loop (or wait event) such that pressing a certain button will trigger execution of the main code as needed.
Message 4 of 8
(2,637 Views)
Maybe you mean that you want to run a subvi (a vi within a vi)? If so, use the while loop to wait for the boolean to be true. Wire an output from the while loop to the subvi. Then the subvi will start when the loop is exited. You could also use an event structure and put the subvi inside the boolean value change event.
- tbob

Inventor of the WORM Global
Message 5 of 8
(2,614 Views)
With a combination of tbob's first post and setting (file>>VI Properties>>Execution>> Run When Opened = yes) you will be able to "start" your VI with a boolean control. You will have a little while loop on the left of your program with only a wait timer and a "start" button in it. This executing loop holds the rest of your program until you press the "start" boolean control thus acting like a start button.

-cheers,
Brett
0 Kudos
Message 6 of 8
(2,594 Views)
Hy! I'm making instrument with tab control.I have 5 tabs on my instrument, and I ned to run each sepperate. Thah is why I need those buttons. In my case when I push run button only one tab is running.When I push start button on next tab control I need to stop previous tab. Maby it is possible to start each separatly?
0 Kudos
Message 7 of 8
(2,566 Views)
First, just to make it clear - a tab control has nothing to do with code execution, but is only a way to conveniently organize your interface. A control that is on a seperate tab can still be part of the code, so your entire program can run at the same time, with no relation to what you see or don't see on the screen. If you do want pieces of your code to run only when a certain tab is selected, the easiest way would be to find the tab terminal on the block diagram. The tab is a numeric control, where the number changes according to which page is selected. So, if you wire the tab as the condition for a case structure which is inside a loop, you can have the code in each case run only when one (or more) of the pages is selected. If this doesn't satisfy you I suggest you post your code.

___________________
Try to take over the world!
0 Kudos
Message 8 of 8
(2,556 Views)