LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

sub-vi

Hello,

I have a question about vis and sub-vis:

What is a good solution for the following problem?
I have a vi that calls a sub-vi. This sub-vi collects (in a while-loop)
datas from a DAQ-card. Now I want to show the datas during the
acquisistion on a graph/chart.

Should I use a indicator in the "main-vi" and a global variable of this
indicator in the sub-vi, or are there any better possibilities?

Thanks,
Hans
0 Kudos
Message 1 of 9
(3,640 Views)
If you right click on the subVI icon after opening it and select show connector, you can connect an indicator out, so that you can pass data out from your subVI, no need of globals.
Hope this helps
0 Kudos
Message 2 of 9
(3,640 Views)
Gorka Larrea schrieb:

> If you right click on the subVI icon after opening it and select show
> connector, you can connect an indicator out, so that you can pass data
> out from your subVI, no need of globals.
> Hope this helps

Thanks,
but my indicator (of the sub-vi) is in a while-loop, in order to show the
datas during the acquisition. If I use the connector-block, the indicator
in the "main-vi" shows only the last value of the measuring.

Hans
0 Kudos
Message 4 of 9
(3,640 Views)
In that case Globals are the only sollution i see.
0 Kudos
Message 7 of 9
(3,640 Views)
I assume you have a while loop in the main vi that contains a nested while loop of the sub-vi.
If it is so, you should remove the while loop in the sub-vi and make the acq.routine execute on each while loop iteration of the main vi. This way the collected data will be available directly in the main vi.Just look at all the acquisition examples in LV.

If this is not possible, in case for example you want the main vi run indipendently from the acquisition vi; then you can place in the main diagram two parallel while loops (not nested): one containing your main vi's original diagram and the other containing the sub-vi's functions. You can exchange data between them by local variables.

I hope I identified your problem, otherwise attach an example of your application.

Good luc
k,
Alberto
0 Kudos
Message 3 of 9
(3,640 Views)
alberto schrieb:

> If this is not possible, in case for example you want the main vi run
> indipendently from the acquisition vi; then you can place in the main
> diagram two parallel while loops (not nested): one containing your
> main vi's original diagram and the other containing the sub-vi's
> functions. You can exchange data between them by local variables.
>
> I hope I identified your problem, otherwise attach an example of your
> application.

My sub-vi is very similar to the LabVIEW example "Cont Acq to Spreadsheet
File.vi" in strmdisk.llb. There is also an indicator in the while-loop in
order to show the datas during the measuring. Now I want to put this vi
in my main-vi and show there the same datas.
I hope my explanations are understandable.

Hans
0 Kudos
Message 5 of 9
(3,640 Views)
It all depends on what you do in your Main.vi.
If it wouldn't slow down acquisition, you could simply modify the acquisition vi diagram placing in its while loop what you do in the Main.vi.
In this way you have one only vi that does both acquisition, visualization and the rest of your Main.vi.
Let me know if this is of any help.
0 Kudos
Message 6 of 9
(3,640 Views)
Thank you, but I took another methode. Now I have an acquisition-sub-vi
that will be opened when I call it in the main-vi, show the acquired
data on a graph and will be closed after the acquisition.
I hope that this way is a good solution.

Hans
0 Kudos
Message 8 of 9
(3,640 Views)
Thank you, but I took another methode. Now I have an acquisition-sub-vi
that will be opened when I call it in the main-vi, show the acquired
data on a graph and will be closed after the acquisition.
I hope that this way is a good solution.

Hans
0 Kudos
Message 9 of 9
(3,640 Views)