LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to make a sub-vi with shift register

Dear,
 
Sometimes, I am confused on treating the shift register (not to use local variable).
 
How to represent the routines inside while or for loop to any sub-vi?
 
Thank you in advance.
0 Kudos
Message 1 of 5
(4,026 Views)

There are many ways to pass data into a sub-vi.  It depends on your application.  If your sub-vi contains a while loop, you can pass data into the vi by wiring the input control to the left side arrow of the shift register.  This will initialize the shift register so that the first iteration of your while loop, the shift register will contain the passed in value.  When your while loop ends in the sub-vi and you are ready to return data, you can wire the right hand side arrow to an indicator outside the while loop and pass that data back to the calling vi.  This is just one of literally hundreds(?) (Maybe close to a hundred!) ways that a shift register may be used to pass data in a sub-vi.

 

Tom

0 Kudos
Message 2 of 5
(4,018 Views)
After coding inside while loop, I want to convert it to sub-vi.
Therefore there is no while loop in sub-vi.
In this case, how to do?
0 Kudos
Message 3 of 5
(4,007 Views)
This attachment (ver. 😎 and its image are for my vi.
I would like to simplify inside while loop (here, FOR loop) by sub-vi.
Is it possible?

메시지가 04-02-2007 08:09 AM에 labmaster에 의해 편집되었음

Download All
0 Kudos
Message 4 of 5
(4,007 Views)

Yes.  The easiest way is to select (highlight) all the code that you would like in the sub-vi.  Then, select Edit --> create sub-vi from the pull down menu.  This will place all the highlighted code into the sub-vi and create the proper controls and indicators on the new sub-vi's front panel.  You will probably need to cleanup a little but it should work for you.

 

Tom

0 Kudos
Message 5 of 5
(3,989 Views)