LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Passing values to a VI that is open dynamically?

Hi!

I need to pass values to a VI that I am openning dynamically.  I tried to open the VI and then pass the values as if it were a subVI.  This works, but has some problems.  The calling VI is "stuck" in the event case until the VI that is called is properly closed.  What I want to do is open the VI, pass the values to the VI, and then allow the user to close/stop that VI if they want or just minimize it and go back to the main VI.

I tried to do this using Shared Variables, and that worked, but it seems like there should be a better way to do this.  This project does not really need shared variables.

Attached is an image of where I am currently at by openning the VI and then passing the values as if it were a subVI.  Just thought of something:  it would also be nice if I didn't have to do any file/path name coding.  I don't like how that file name is now hard-coded into the block diagram for that VI.  I like how subVIs update their name automatically from within the same project.

Thanks for your help!
-Nic
Message 1 of 4
(2,775 Views)
oopps..forgot to attach the image.
0 Kudos
Message 2 of 4
(2,774 Views)

This topic is not a simple one, but there are several ways to do this and the correct solution basically depends on what it is you actually want to do. Here are some relevant points. It's definitely not coming close to properly covering the topic:

  • What you're doing now is irrelevant - you could just call the subVI and set its FP to open when called.
  • You can get the path by doing this:
  • You can run the VI dynamically by using the call by reference node, but that will also make your event loop wait for the call to be over.
  • You can use a message handler or a queued state machine running in another loop to open the VI. You can see some examples in LabVIEW's File>>New dialog or on the web. Here's one example.
  • You can communicate between VIs using notifiers, queues or LabVIEW 2 style globals (example).
  • I suspect that in your case, what you want can be accomplished by running the VI as a parallel process (simply place it outside your main loop) and then use invoke nodes to open its FP when needed. You can get a reference to it by using the static VI reference object found in the Application Control palette. You can communicate with it using any of the methods mentioned in the previous bullet.

I suggest you do some searching for methods for communicating between VIs. There is a lot of material online.

 


___________________
Try to take over the world!
0 Kudos
Message 3 of 4
(2,746 Views)
0 Kudos
Message 4 of 4
(2,743 Views)