LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI problems

Hello
 
I have made a small library of often used SubVI's , e.g. a first order filter, an integrator etc. I recently made a VI and placed a couple of the same subvi's and experienced, that they all shared the input of the first placed subvi even though they where all connected to different inputs. Do I have to somehow restrict the controls (which ofcourse have the same name in the subvi's) somehow to make this work, they are somhow interconnected.
 
soren 
0 Kudos
Message 1 of 6
(3,187 Views)

Hi soeren,

how do you see that they all share the same input? I think what you see is the last call of the vi. Remember it is always the same vi!

Mike

0 Kudos
Message 2 of 6
(3,181 Views)

Hi

I've attached an example where i've put in two samples of the same vi, with the possibility of altering the inputs, but they seem interconnected, which was not the intention.

soeren

Download All
0 Kudos
Message 3 of 6
(3,151 Views)
Hi soeren,

try the attachment...

I did:
- made subvis reentrant to have independent operation!!!
- replaced locals (in the subvis) with a while loop/shift register (equivalent, but better programming style)
- changed connector pattern (inputs left, outputs right!)
- cleaned them up

You may set the inputs (K, initial condition) to their default values (1,0) when this is a common value... No need to wire the constants.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 4 of 6
(3,141 Views)
Hi
 
Thanks for the help, it works neatly, and I guess it can be used in timed loops also without ruining the timing because of your "run once" trick in the while loop. You wrote that you "made subvis reentrant to have independent operation!!!" , can this be specified somewhere.
 
Best regards
 
soeren
 
 
0 Kudos
Message 5 of 6
(3,133 Views)
Hi soeren,

to run one vi at multiple places independently from each other you have to make it reentrant. You can do so in the vi properties at tab "execution".
When you don't do this those several copies of the vi share the same memory and will use the same locals or shift registers in each occurance - hence your "they seem to be interconnected"Smiley Wink

Read the LabView help (just look for "reentrant")!


Message Edited by GerdW on 03-03-2008 01:57 PM

Message Edited by GerdW on 03-03-2008 01:57 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 6 of 6
(3,126 Views)