LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI doesen`t work

I have placed SubVI in my code and when I run program and double-click SubVI, it`s front panel shows every data properly (it shift when it should and so on), but that data doesen`t shift in main program as it does in SubVI. Any tips what could be wrong?
0 Kudos
Message 1 of 9
(3,512 Views)
Hi,

It seems to me from you description, that your subvi is constantly running, in a loop or so, the output of that subvi is only available in the main program when it stops running. There are also other ways, for instance using references for the main controls in the subvi.
If this is not the case, post your code, or a pice of it to demonstrate your problem.

Hope it helps,
Paulo
0 Kudos
Message 2 of 9
(3,498 Views)
Hi again,

Is there any way to bring data from that SubVi without stopping while loop in subVi?
I have some counter calculations in while loop and counter value is zero if while loop is stopped, so it would be much more easier if I can bring data out from While loop without stopping it.

Does it help if I put shift register in while loop and wire data out from loop via shift register?
How about local variables? Do they shift values through subvi`s boundaries?

That attachment (Kytta2.vi) is the subvi we are talking about.

- Santtu
0 Kudos
Message 3 of 9
(3,481 Views)
A global variable (preferably a LV2 style) and not a local variable will work. As Paulo mentioned, a reference will work as well. But, since you have to make the subVI visible in order for someone to click the stop button and the subVI has to be stopped before your main VI will resume control, isn't displaying the values on the subVI's front panel enough?
0 Kudos
Message 4 of 9
(3,468 Views)
Hello,

The way to pass data from a subvi to a main vi without stopping the subvi is via control references.
Right click the controls whose values you want to pass to the main vi and choose Create Reference.
Then pass these references to the subvi, instead of the control itself.
Then in the subvi, using a property node, change the value of those controls.
Take care that if you just call this subvi cnormally (placing it on the block diagram of the main) the main vi will stop running until the subvi ends and them it can continue. To have to main vi running in paralel with your subvi, call it via the vi server engine - check examples shipped with LabVIEW - in programaticaly controlling vi's group.

Check example in annex.
Hope this helps,
Paulo
Message 5 of 9
(3,464 Views)
Hi,

No, it is not enough that values shows only in subvi`s front panel, because mainvi needs that data. Main program needs pulse sensors position (from that subvi, (it`s that Kaannon asema-anturin arvo)), data from two emergency stop-buttons and from that subvi comes also stop signal to main program (digital start/stop button which linestatus is read in subvi). All those input and outputs in subvi´s front panel are actually nessesery for programs functionality. In other word they should be brought in or out that subvi, while it is running.

Does this make any sense at all? 🙂
-Santtu
0 Kudos
Message 6 of 9
(3,460 Views)
Thanks Paolo!

Now I think I heard what I wanted to. I try those references. Hope them solve my problem. We will see.
But thank You anyway.
- Santtu
0 Kudos
Message 7 of 9
(3,453 Views)
Hi,

One more question for PauloM:
I have Labview version 6.i, so, I cannot open that your example. So, if You please could save it in labview 6 format (is that possible?) and put it again here?
- Santtu
0 Kudos
Message 8 of 9
(3,437 Views)
Hello,

Here it is 🙂

Best Regards,

JLS
Best,
JLS
Sixclear
0 Kudos
Message 9 of 9
(3,396 Views)