LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Connecting vi's to build a dynamic system

I have four vi's. For ease, I'll call them A, B, C, and D. I would like to set it up so that the user opens A, enters their data, then clicks on a button that opens B. Once the user is finished with B, they click a button on B which opens C. Once done with C, they click on a button which opens D - the final program.
I don't think this should be that difficult to do, but I'm just not sure how to do it. I'm thinking sequencing structures? Could someone show me how to set this up? Thanks.
0 Kudos
Message 1 of 41
(3,355 Views)
All you have to do is watch the OK or Next button (with LabVIEW 6.1, event structures are the way to go) and when it's clicked, inside the "OK: Value changed" case you drop the VI for the next stage on your diagram. This VI should be marked "Show Front Panel When Called" on the VI Info screen.

An easier way to implement this type of enter data / click Next / enter more data / click Next strategy, though, might be to put each stage on a separate page of a tab control, rather then splitting them among four VIs. You could use a state machine to cycle through the states much more easily and flexibly (for example, Back buttons are easy to add) than with a sequ
ence structure.
0 Kudos
Message 2 of 41
(3,351 Views)
I only have labview 6.0. I'm not sure if it has event structures. Is there any way I could see what this looks like (I'm very new to this).
0 Kudos
Message 3 of 41
(3,351 Views)
LV 6.0 doesn't have event structures. But there are several ways of acomplishing what you want.

First of all, don't use sequence structures--ever. They really aren't necessary and have some very bad side-effects. The way to keep things from happening all at once is to use LV's dataflow. Remember that no node (subVI, loop, etc) starts executing until all its inputs are satisfied. So if one subVI get's a piece of data--say an error cluster--from a previous subVI it won't run until that previous subVI finishes.

Second, to get a subVI to open its front panel there are a couple check boxes in the VI Properties that will do this for you. Check under Window Appearance>>Custom, or just set the thing to be a dialog box in the Window Appearance screen.

Now
take these two things together and you have everything you need to build your application. Each of your subVIs should have error IO clusters on them to pass through errors that occur during their execution (like the operator decided to abort the whole process an hit a cancel button). Use the error IO terminals to string the subVI functions together in the order you want them to execute, configure the subVI VI Parameters as mentioned above and you're done.

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
Message 4 of 41
(3,351 Views)
LabVIEW 6.0 doesn't have event structures, but there are other ways to see which button is pushed. For example, you can read your OK / Next button inside a While loop (you'll need to put a Wait 100 ms inside the while loop, too), and when the button reads True, you show the next state of your user interface.
0 Kudos
Message 5 of 41
(3,351 Views)
Here's a simple example that shows a state machine architecture,next-back,passing data between subVIs, etc.
0 Kudos
Message 6 of 41
(3,351 Views)
I don't really know how to do this, or if I'm even explaining myself correctly. I have four different files that do four different things. I want to be able to open one from another. What I'm thinking is putting the subvi's of three of my files onto the main VI, but then how do I connect them together. Do I put them all in seperate while loops? How do I connect them? How do I set up buttons to go from one to the other. I just need it to go from A > B > C > D. Once B opens, A can close, it won't be needed anymore, et cetera.
0 Kudos
Message 7 of 41
(3,351 Views)
Ok, should A closing be what opens B? Or should the user have to press individual buttons to open each one?

Mike...

Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion

"... after all, He's not a tame lion..."

For help with grief and grieving.
0 Kudos
Message 8 of 41
(3,351 Views)
Maybe you need to look at Chapter 16 of the user manual - "Programmatically Controlling VI's" (Help>>View Printed Manuals>>LabVIEW User Manual)

or check in Search Examples>>Advanced Examples>>Execution Control>>Dynamic Loading VI's

this may help you to do what you want

or, as one of the other answers says, you may be able to achieve what you want with a state machine - just a set of cases in a while loop, a subvi in each case, and controlled with the subvi node setup to close when you're done. If you haven't used a state machine before, look for some simple examples - they are very useful.
0 Kudos
Message 9 of 41
(3,204 Views)
The most flexible way to do this is to create a fifth VI that runs the four others one after the other in a state machine. But a simpler approach is to use dataflow to determine the order in which the VIs run: put an "error in" and "error out" cluster on each subVI (which is good practice anyway), and then the dataflow will determine the order in which the subVIs run. Also, a subVI won't execute until the one before it runs.

See the attached example in LabVIEW 6.0 format.
0 Kudos
Message 10 of 41
(3,204 Views)