LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do I open and close VIs from within a VI?

Ladies and gentlemen,
 
I would like to use a VI to open and close other VIs based on user input.  Example:  The first VI will have text that reads:  "Does the car have heated mirrors?"  There will be two buttons: one for "YES" and the other for "NO."
 
If the user hits the "NO" button, the current VI will close and a similar VI will open that asks the user the next question, "Are the mirrors lighted?" "YES" or "NO..."
 
If the user hits the "YES" button, the current VI will close and another will open that will tell the user to "Activate the heated mirrors" and press a button that will say "NEXT."  At that point, that VI will close, and in two minutes another VI will open and ask the user "Is the driver's side mirror hot?" with another set of "Yes" or "No" buttons.  If the user presses "YES" we will have verified that the heated driver's side mirror is working properly and store that information somewhere .  If the user presses "NO", the VI will close and another VI will open with some kind of repair instruction and a button that says "RETEST" that will rerun the heated mirror test when repairs are completed.
 
During the two minutes we are waiting for the mirrors to heat up the program should move on to the next question: "Are the mirrors lighted?" "YES" or "NO..."
 
Does anyone know how to manipulate VIs in this way?  Please help!
 
Drew
 
   
0 Kudos
Message 1 of 4
(2,752 Views)

Instead of opening and closing vi's, just create one main vi with a state machine architecture.  Search for examples on state machines to get a basic understanding of them.  This is pretty complex so I have written an example of how this could be accomplished.  The trick part was the 2 minute timer (my vi is set for 5 seconds for quick testing).  Each state produces a question, and depending on the answer, the next state is inserted into a queue.  You can add more states for more questions and answers.  Notice that the boolean buttons can be hidden if you just want to show one button (like Next) instead of two buttons (Yes and No).  Study the vi and let me know if you have questions.

 

- tbob

Inventor of the WORM Global
0 Kudos
Message 2 of 4
(2,744 Views)
Hellow!
I am interested in your program,could you please make a lower version one? thanks!
0 Kudos
Message 3 of 4
(2,742 Views)
What version do you want?  7.0, 6.1, 5.1.1?
- tbob

Inventor of the WORM Global
0 Kudos
Message 4 of 4
(2,726 Views)