LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can i recursivly call a vi

i am writing a program to build messages to be sent along a tcp connection.

the program reads in message definitions froma file, and calls an appropriate vi to build each individual field. However, some fields are compound fields, made up of other field types. I would like to be able to call the vi that selects fields from itself. Is there anyway to do this?
0 Kudos
Message 1 of 5
(3,196 Views)
Matthew Simpson schrieb:
> i am writing a program to build messages to be sent along a tcp
> connection.
>
> the program reads in message definitions froma file, and calls an
> appropriate vi to build each individual field. However, some fields
> are compound fields, made up of other field types. I would like to be
> able to call the vi that selects fields from itself. Is there anyway
> to do this?

Nope, you can't call subVI's recursivly. 😕

--
Henrik Skupin
0 Kudos
Message 2 of 5
(3,196 Views)
Yes you can.

Make the SubVI reentrant.
In the SubVI, you call next level with a dynamic call to itself. When opening a reference to a reentrant VI, e new instance is created. Call the subVI and close the reference.
However it is inefficient. Most of the time, it can be implemented otherwise, keeping a stack of inputs in the shift registers of a while loop.


LabVIEW, C'est LabVIEW

Message 3 of 5
(3,196 Views)
Is this possible in LV6.1 ? I have tried following what you said, but i get an error saying "attempting recursive call"
0 Kudos
Message 4 of 5
(3,196 Views)
Here is the classical factorial example, it works in 6.0. Two important things to check:
- the subVI is reentrant
- a new reference is opened for each new level of recursion.


LabVIEW, C'est LabVIEW

Message 5 of 5
(3,196 Views)