From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

UserEvents to communicate between subVIs and a main VI

Solved!
Go to solution

You need a Run Method on that wire now that you have inserted the subVI in the subpanel.

 

(What does the subVI with the T on it do in that same event structure?)

0 Kudos
Message 11 of 16
(1,030 Views)

Sorry, I cannot have a too detailed look how to do it today, but I will try to program a possible example.

Actually does it work now as you want? If you need faster help, upload your main vi and the subVI, so someone else might can help too.

Just a few comments for the picture: you want to load the two instances of the subVI into the two subpanel by the user? If so, it looks ok. However:

  1. Use a latch mechanical action for the Start1 and Start2 buttons. You do not need to connect these controls to anything, and also delete the case structures. The Event case only fires if the user clicks on the Start button. But imagine what happens, if the user clicks again, when the vit is already loaded into the subpanel. I think you will generate error!
  2. Do NOT use the Flat Sequence structure! Connect the Subpanel invoke node to the subVI with an error wire! Also, you should revise/enhance error handling...

So I repeate, sorry, today i have a very hectic day, I really advice you to upload your actual VIs, and explain the details, what works, what not, and what is your exact goal. You will get help from others too much faster!

Good luck & have nice weekend!

 

 


EDIT: as RavensFan wrote: you need the run method, and not needed the subVI, but as I see you fixed it. But please, do not post pictures, post snippets or your VIs! (snippet: http://www.ni.com/tutorial/9330/en/ )

0 Kudos
Message 12 of 16
(1,023 Views)

Ravensfan:

How can I do that?

 

Blook:

I also had a busy weekend or at least at weekend doing other things than coding. Just 2 quick questions: Why not use Flat Sequence structure? Is it because I don’t get the info I will get user error lines?

And how to use latch mechanical action?  What will you gain using this in this situation ? I’m aware of the 6 settlings for a button

Thanks for the snippets advice. Didn’t know about this smart function.

0 Kudos
Message 13 of 16
(980 Views)

In general, it is a Good Idea to have an Error Line running through the lower corners of your sub-VIs, as is the case with most LabVIEW Functions on the Functions Palettes.  This being the case, enforcing a Serial order by putting VIs serially on the Error Line is (to my eye) more visually appealing (and much more compact) than placing them in big, clunky, surrounding Flat Sequences.  The only time I use a Flat Sequence is when I need to "order" a Function (such as a Timer) that does not have an Error line -- I often place it on/near the Error Line where it would go if it did have an Error Line Running Through It (there was a recent movie with a that title, or something close, recently) and surround it with a Flat Sequence Frame, tunnelling the Error Line through the Frame.

 

As for Mechanical Actions, the Latches (particular Latch when Released) lets the Boolean Control be "momentary" (it "pops up" when it is read so you don't have to "turn it off").  It is most commonly used in conjunction with the Event Structure's Value Change Event, with the Control being placed inside its Event case.  Being in an Event Structure means that as soon as the Control is Released, its value changes, the Event "fires", the Control is read, and it "unsets" itself, all in microseconds without you needing to even think about it.

 

Bob Schor

0 Kudos
Message 14 of 16
(965 Views)

@Michael.Koppelgaard wrote:

Ravensfan:

How can I do that?

 


Look in example finder for "Multiple VI's in a Subpanel"

0 Kudos
Message 15 of 16
(944 Views)

Thank you for your answers Bob and RanvensFan.

Bob: the first one correct, the second one wrong. But i both examples the numeric only increment with 1. If I understand you correct it should increment with 2 in last example because the event fires to times because the botton is not reset. Or ? 

 

Bob :control outside loop.pngcontrol outside loop.png

Download All
0 Kudos
Message 16 of 16
(910 Views)