LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Recursive call of vis

Hiii All,
 
             I am using no of vis continuosly mean when the condition of the first vi completes, i am calling another vi, at that time the last vi remains open, instead i want that the last vi should be closed and only the current vi should be open, and another thing is suppose i want to go to the last vi, from the current vi, then i have to call the last vi from this vi, which is a recursive call of vi, which labview does not allow, so can anybody please give me suggetion??
 
Thank you in Advance
 
Rujuta
0 Kudos
Message 1 of 6
(3,454 Views)
Hi
 
I'm not sure if I understood correctly what you want to do, but you could use a statemachine.
 
Thomas
Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 2 of 6
(3,449 Views)

Hiii, Thomas

            I dont know what is state machine, so can you please explain me about that??? and my question is about calling another vi from current vi, and after calling the another vi, from that another vi, i want to call the current vi, which is recursive mean one from another and another from one, recursive call...

Thank you,

Rujuta

  

0 Kudos
Message 3 of 6
(3,446 Views)

In a statemachine you have different states, where something is done. To change the states you have different transition, which depend on results or user input or something similar.

In LV you basicall have a while-loop with a shift register. In the loop there is a case structure. So in each case you have program logic of a state. Basically I always use an enum-type to set the cases. This enum contains for instance four values: Init, ProcA, ProcB, End. So I first wire "Init" to the shiftregister, which is wired to the case selector. Then I do some initialising in the Init-case and wire a constant of this enum (set to ProcA) from out of this case to the shiftregister terminal on the right. So the next iteration ProcA is executed. There I do some processing. Based on this processing I wire either ProcA or ProcB to the shiftregister and so on.

So my thought was that you could call Vi A in a case, then call Vi B in another case and then call the case with Vi A again, but then switch to the case of let's say Vi C.

Let me know if I was not clear enough.

Thomas

Using LV8.0
--------------------------------------------------------------------
Don't be afraid to rate a good answer... 😉
--------------------------------------------------------------------
0 Kudos
Message 4 of 6
(3,441 Views)
You can read about state machines:

here
here
here
here
0 Kudos
Message 5 of 6
(3,432 Views)
LabVIEW does not support the recursive calling of normal VIs.  However, you can do it by saving your VI as a VI template (just change the file suffix to .vit) and opening and running it using VI server.  Note that you load a total new copy of the VI every time you do this, so you can rapidly run out of memory.  You can get more information on using template VIs from the LabVIEW documentation.  You can also try searching this discussion forum for examples like this.  Good luck.
0 Kudos
Message 6 of 6
(3,412 Views)