09-03-2010 01:39 PM
Hello,
I'm trying to create a subvi from this vi (see attached image or vi), but I don't know how to pass the shift registers to the sub vi. The main vi is also a while loop so I want to initialize them there and pass them to the subvi. Is it possible in this case?
Also, I plan to implement this subvi 3-4 times in the main vi (to be called by different inputs), and I'm not sure that I understand the difference between the different reentrant types: preallocate clone for each instance & share clones between instances. I think I need the first type, is this correct?
Thank you,
Solved! Go to Solution.
09-03-2010 11:48 PM
@simply_me wrote:
Hello,
I'm trying to create a subvi from this vi (see attached image or vi), but I don't know how to pass the shift registers to the sub vi. The main vi is also a while loop so I want to initialize them there and pass them to the subvi. Is it possible in this case?
All VIs can be subVIs - it's only a matter of whether they're called by another VI. I don't know what you mean by "passing the shift register to the subVI". If you want to pass the initial conditions for the shift register, then just create controls and wire those to the shift register rather than the array constants that you have. You have no controls connected to the connector pane, so right now you won't be able to pass anything into this VI or get anything out. Do you know how to use the connector pane? This is explained in the LabVIEW Help and also covered in the LabVIEW tutorials.
Also, I plan to implement this subvi 3-4 times in the main vi (to be called by different inputs), and I'm not sure that I understand the difference between the different reentrant types: preallocate clone for each instance & share clones between instances. I think I need the first type, is this correct?
It kind of depends on what you're trying to do. There is a page in the LabVIEW Help that discusses this. From the Table of Contents you go to Fundamentals -> Managing Performance and Memory -> Concepts -> Multitasking, Multithreading and Multiprocessing -> Multithreading -> Suggestions for Using Execution Systems and Priorities.
In your case you do not have an unintialized shift register, and it even sounds like you're going to pass in an initial value, so there's no need to save state information (the shift register). If this is not what you want to happen then you need to provide a bit more information as to how this VI is supposed to be used.
09-04-2010 03:55 AM
Hi Smercurio_fc,
By "passing the shift register values..." I mean that I want to strip away the while loop structure in order to implement it as a subvi in the main vi while loop. I do know how to dbl, U8, and etc... as controls/indicators from/to a subvi, but how can you do that with shift registers? You can't just output/input an array of dbl or strings, it didn't work when I tried it....
As a subvi that is called multiple times I'm afraid that it'll slow down the performance with out reentrant definition.This vi is going to be called 3-4 times simultaneously (once for x, y, and diameteer), and I don't want any parts of the software to wait on the other parts. I think Preallocate clone for each instance should work, as it clones the vi for each instance (so a toatl of 3 copies if I understand correctly).
Thank you for the response,
09-04-2010 10:31 AM
@simply_me wrote:
Hi Smercurio_fc,
input an array of dbl or strings, it didn't work when I tried it....
Of course you can. Most things in LabVIEW wouldn't be able to work without it.
Right click on an array wire and pick Create Control and Create Indicator. Now you have the input and output arrays that will be a part of your connector panel. Your subVI won't have the shift register. The shift register will be a part of thw while loop in the larger VI that passes the array into the subV and gets the results back out.
09-04-2010 03:14 PM
Thanks, that was actually easy once I tried it.... I just didn't think it is possible.
Thank you both for your replies.