LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to pass values from child vi to its parent while executing and how can they run without being affected by the time delays of each other?

Hello,

I have 2 "vi" files in a project.

One is the 'parent' and it runs continuously in a while loop.

The other is the child 'vi' and it runs whenever is called from the parent vi.

 

First problem:

When the parent vi calls the child, it gives to it some values and when it finishes its execution, the child returns some other values to the parent.

But what if I want to get some values from the child while it is executing? I can't. I even used global variables to get the values instantly from the child vi, but these variables change their values, only after the execution of the child vi.

What should be the problem?

 

Second problem:

The child vi has some time delays, because it needs to wait for the response of some machines.

But these time delays affect the parent vi, in the way that a real-time graph pauses its execution.

How can they run in parallel without the parent having to wait for the child to finish its execution?

 

Thank you in advance.

Message Edited by nikosfs on 05-29-2009 01:14 PM
0 Kudos
Message 1 of 18
(3,628 Views)

Nikosfs,

 

What you are trying to do is possible.  You can get the sub.vi to update the calling vi's graph by passing a referance to the graph into the subvi. I've attached an example.

 

In your application you suggest that the values in the sub vi really should be accessable by both in near real time.  To get this use a functional global (or an action engine) there a tons of examples on the forum.


"Should be" isn't "Is" -Jay
Download All
0 Kudos
Message 2 of 18
(3,622 Views)

I found some examples, but I have the LabView version 8.2.1

How can I convert files of newer versions, in order to open them?

 

Thank you.

0 Kudos
Message 3 of 18
(3,615 Views)

nikosfs wrote:

I found some examples, but I have the LabView version 8.2.1

How can I convert files of newer versions, in order to open them?


You post them on the forums and nicely ask someone to convert them for you Smiley Happy

Cory K
0 Kudos
Message 4 of 18
(3,611 Views)

Sorry,

I gotta get my NI rep to bring in the older LV versions but I haven't had the time here yet.  Cory, are you set up for this?


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 18
(3,599 Views)
Yeh, I can convert them down for you.
Cory K
0 Kudos
Message 6 of 18
(3,581 Views)
Are you referring to Jeff's VIs or did you find some examples elsewhere you were referring to?
Cory K
0 Kudos
Message 7 of 18
(3,566 Views)

Could you please post again the sub.vi and the caller.vi in previous version format? (8.2.1 and older).

I didn't succeed in passing a reference to the child vi. I can create it in the parent vi, but how can I pass it? I suppose that I have to create a similar object in the child vi, in order to connect the reference of the parent, with it. In my example, the object is a Waveform Chart.

 

Is it also possible to post an example of a Functional Variable?

I found one here: http://decibel.ni.com/content/docs/DOC-2143

If i understood, I have to use shift registers, which can change the value of a global variable instantly, and not have to wait till the end of the child's execution. Is it true?

But, my 'child vi' does not run in a loop, instead, it is executed only once, each time the parent calls it. It is only the parent that runs in a while loop.

 

I appreciate very much your help.

0 Kudos
Message 8 of 18
(3,562 Views)
I was refering to the example that I attach, but also to the VIs posted in the first reply.
0 Kudos
Message 9 of 18
(3,561 Views)