LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

wrap a vi having indicators into a stand-alone block

Solved!
Go to solution
Solution
Accepted by topic author Accuiti-Bob

Hello Jordan and all.  Your advice has sent me on an exploration of new Labview territory (certainly new for me).  I first went through Jordan's example with the cluster of a forward and a backward queue communicating between the separate while loops and was successful in integrating that into my main test program and into the virtual BK1687 code I had written.  It worked exactly as I hoped.  

 

However upon post examination I thought the queue memory and FIFO structure were way overkill for the situation - I only needed a single state of the communications forward and back in memory.  For the power suppy, it made no sense to queue up commands.  So, understanding how the queues were communicated through the loops via refnums (pointers), I re-did the architecture with a refnum to a cluster and was able to get this to work just as well.

 

I broke my virtual connection into 3 pieces:  The "main fan-in" connector, a "BK cable", and a power supply "fan-out" connector, as 3 separate VIs.  The "BK cable" VI goes between the main block and the virtual power supply block.  The "BK cable" VI declares a 7 element cluster and gets a reference to it.  The supposed in and out of the "BK cable" are actually both outputs of type cluster refnum.  So, the "BK cable" is creating the memory for the cluster to be exchanged and getting a pointer (refnum) to it which is passed out left and right.  It is the pointer to this cluster memory that is passed through the main loop and the virtual power supply loops. 

 

It was relatively painful for the fan-in and fan-out of the wires, so separate connector VIs were created for this.  You can think of it like having 2 physical circuit boards, each in a box (the while loops) that you want to interconnect.  In your main control box, you have a connector that has lots of connections to your board.  This is bundled into a cable to go to the other instrument box.  In the other instrument box there is another connector to fan out the connections to its board.

 

I saw a mention somewhere that you cannot put controls and indicators in the same cluster.  It turns out not to make a difference in this case - they are just typed memory locations with a pointer (refnum).

 

I am including my test circuit for anyone else facing the same problem.  The only thing I am worried about this is whether I am creating a memory leak.

 

Thank you all for your support as I worked my way through this!

 

0 Kudos
Message 31 of 31
(565 Views)