LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Event Structure in Sub VI

Greetings! 

 

I'm fairly new to using event driven structures. The problem I have is when it is used in a single VI to react on "Value Change: it works fine, but when I use it in a sub-VI, it doesn't work at all.

 

Any advise?

 

0 Kudos
Message 1 of 7
(3,903 Views)

You'll need to post the code (not a picture) so we can see how the rest of the VI is written.  This is not enough information to help narrow down the problem. 

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 7
(3,899 Views)

Yes, please attach your code.

 

  • Is "analog out.out 1" a control or indicator?
  • Is the front panel of the subVI open?
  • What's in the calling VI?
  • How are you calling the subVI?
  • What's on the connector pane?
  • What's in the other events?
  • What does the VI actually do?
  • What do you expect it to do?
  • ...
0 Kudos
Message 3 of 7
(3,881 Views)

this program is far too large, and too complicated to explain. I will make a simple example and send it

0 Kudos
Message 4 of 7
(3,869 Views)

The event structure on the subVI is looking at the controls on the subVI.  And it will not react to programmatic value changes (you pass data in or write with a local variable).

 

In general, your GUI should be done by a single loop with an Event Structure on the top level GUI.  And the timeout should not be needed in 95% of the applications out there.  Let your subVIs do one specific thing that does not depend on the GUI and then you open yourself up to being able to reuse that VI elsewhere.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 5 of 7
(3,867 Views)

Two options, look at the examples:

  1. Use User Events to send information to the subVI.
  2. Use Dynamic Event Registration. You will need a reference to your Front Panel Control to input into the subVI.

Number 2 is probably the easiest to implement.

Snap6.png

 

 

 

 

mcduff

Message 6 of 7
(3,860 Views)

 CAN use dynamic Event registration IN A SUB-VI to register for value changes in the FP of another VI.

 

See here for a nugget on Dynamic Event registration.

 

I use that very often when I have a sub-VI devoted to a very small part of the main application.

 

Dynamic_Event.JPG

 

Please note that you have to think about if and when the GUI is locked on the event and that static events are serviced before dynamics etc etc etc.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 7 of 7
(3,853 Views)