LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

moving data from a subVI to mainVI - example code provided, help needed!

Hi all, I've written a set of VIs that are a part of a larger program, but I've come to a bit of a stumbling point and would appreciate some assistance.  The VI's are attached.  The mainVI calls subVI with a simple conditional.  When the subVI runs, it is used to generate an array that will be passed back to mainVI for use elsewhere in the program.

There are several things that I would like to have happen:
  1. I want the 'load params' button in subVI to pass the array back to mainVI without having to close the subVI. 
    • Is it possible to still use shift registers and do this somehow??
  2. I want the subVI to be able to remain open in the background if the user chooses, or to be able to be shut if the user chooses.
    • I can't figure out how to do this.

I'm open to suggestions, even if they include radically altering the way that the program is written.

thanks,
-z

Message Edited by zskillz on 10-25-2006 11:12 AM

Download All
0 Kudos
Message 1 of 7
(3,169 Views)
Hi z,

well , there are no vi's attached 😞

2) There are vi properties to have the front panel open or hidden. You can use them to provide the functionality you need.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(3,164 Views)
wow! you respond quickly - I attached them right after posting when i realized that the 'post preview' erases the attachement area...

anyway - take a look now please,

-z

p.s. - these are in LV8
0 Kudos
Message 3 of 7
(3,162 Views)
the attachment still didn't make it but there are a couple of ways you can do it without closing the subVI and using the wire. You can write to a global vairable in the subVI and read it in the main. You can create a control reference of an indicator of the main VI, wire this to the subVI and write to the reference's value property. You can start the subVI with an invoke node (run method) and then in the main, read the subVI's indicators with a Get Control Value (Variant) method. See this very recent post on the same subject for examples of the first two techniques.
0 Kudos
Message 4 of 7
(3,151 Views)
let me try and attach them again...

Download All
0 Kudos
Message 5 of 7
(3,145 Views)
Hi Dennis,
   

@Dennis Knutson wrote:
the attachment still didn't make it but there are a couple of ways you can do it without closing the subVI and using the wire. You can write to a global vairable in the subVI and read it in the main. You can create a control reference of an indicator of the main VI, wire this to the subVI and write to the reference's value property. You can start the subVI with an invoke node (run method) and then in the main, read the subVI's indicators with a Get Control Value (Variant) method. See this very recent post on the same subject for examples of the first two techniques.


1) I don't want to use globals.
2) If I use control references, then there's really no need to use the shift registers as I have them set up... correct?  Basically I'll just be writing to an indicator that's in the mainVI. I can then use that information however I please.  The problem I have with this is that I was really trying to avoid using references.  I think that they're quite difficult to follow when your trying to diagnose a problem or if you need to write very clean code that will be easy for someone else to read.
3) the 'get control value' sounds interesting, but I want subVI to control when the data is passed to mainVI, so I don't think this is the proper approach.  Am I incorrect?

also -- I've gone through the other threads on this topic many times before I posted this.  Some of them are helpful, some of them are less so.  Anyway, I couldn't not find an answer to the question about being able to maintiain the use of shift registers for this type of approach??

thanks
-z
0 Kudos
Message 6 of 7
(3,128 Views)

I can't open your code because my eval version of 8.2 just expired.

I would agree that regular globals make code harder to follow and that's also true to some extent with control references.  A few comments scattered on the diagrams could help. Have you looked at what is called LV2 Style Functional Globals? Basically, they are VIs with unitialized shift registers. Also, if you want, you can write to the shift register in the subVI the same way you are doing now and also write to a control reference. You can even pass data back though a wire from the subVI in the same manner when the subVI finishes.

0 Kudos
Message 7 of 7
(3,110 Views)