LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Events in SubVi not working as expected

Solved!
Go to solution

Hi, I am reposting this question as my previous one didn't resulted in any satisfactory conclusion.

I have attached my Vi's which are not working as expected. If I remove ONE subVi and its associated 3 controls and two indicators, the other one works just fine, but when I add two SUB Vis, it goes messy. I am trying to learn this way, I am sure it can be done many other ways, but please help me finding out the problem doing it this way as in my final MainVi, I would like to use 8 such sub Vis. Thanks.

Download All
0 Kudos
Message 1 of 2
(2,440 Views)
Solution
Accepted by Silencer

Your main problem is DATA FLOW.  A loop cannot iterate until EVERYTHING in it has completed.  So, as you have it, you have to have both event structures execture before you can go back to look for the next event.  So if you insist on having these subVIs, they need to be in seperate loops.

 

BTW, you can get away with a single subVI.  Go into the VI properties and make it reentrant (preallocated clone).  Then each call of your subVI will have its own memory space.  A lot easier to maintain that way.

 

And I know you said you didn't want alternatives, but here's how you can do it all with a single event structure in your main loop.


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
Message 2 of 2
(2,415 Views)