LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing the result of a sub VI with event structure back to the top VI

Hi All

 

I am experimenting with using event structures in sub-VIs with the eventual goal of consolidating a very large control system I am working on.

 

Attached is the toy-model I am working on. The VI works in the sense that the top level VI can control the the sub level VI, but then I want to pass the results back to the top level -- in this case it just a a Boolean LED indicator. I think I could achieve this using a refnum indicator and then converting this to boolean with a property node in the top level VI but this feels a bit clumsy.

 

VIs are attached!

Download All
0 Kudos
Message 1 of 6
(3,147 Views)

Yes.  You need to pass in refnums of your indicators on the main VI.

 

This isn't clumsy.  What is clumsy is having a subVI that runs forever.  Your main VI can technically never end without aborting your program because once it calls the subVI, the subVI has an infinite while loop.

0 Kudos
Message 2 of 6
(3,143 Views)

Okay I see. What would you suggest to implement what I am trying to achieve in a better way?

0 Kudos
Message 3 of 6
(3,140 Views)

I don't really know what you are trying to achieve.

 

Why do yo have a subVI with a while loop in it?  Not that you can't do that, but when you do, you are going to treat it like a parallel process. That means not having indicators directly based on it by way of its connector panel.  Also you need a communication mechanism to tell it when to shutdown.

0 Kudos
Message 4 of 6
(3,135 Views)

Essentially code reduction. I am redeveloping a very large control system. This system currently has about 20 different event structures each containing relatively complex code. I want to bundle these individual routines up into subVIs to make everything more manageable, hence my experimenting with the attached example.

0 Kudos
Message 5 of 6
(3,127 Views)

I guess this is a continuation of this earlier discussion. Why not keep it all in one place?

0 Kudos
Message 6 of 6
(3,112 Views)