LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

while loops and shift registers

Im using a while loop to build an array (sounds familiar? - I just read that post), I init the array outside of the loop and use Insert into Array to gather the data inside the loop (for a waveform). The other post told me where to look (shift registers) but not how to use them.

The user manual has quite a difficult description of how to work with shift registers and im just wondering:

Which shift register do I wire the initial array to?
and
In what configuration do I wire the shift registers within the loop to store my array and update it each iteration? (I had a few attempts after reading the section in the manual but didnt seem to get anywhere).

Thanks.

Thomas
0 Kudos
Message 1 of 4
(3,409 Views)
On Thu, 4 Jul 2002 10:19:00 -0700 (PDT), TMC wrote:

>Im using a while loop to build an array (sounds familiar? - I just
>read that post), I init the array outside of the loop and use Insert
>into Array to gather the data inside the loop (for a waveform). The
>other post told me where to look (shift registers) but not how to use
>them.
>
>The user manual has quite a difficult description of how to work with
>shift registers and im just wondering:
>
>Which shift register do I wire the initial array to?
>and
>In what configuration do I wire the shift registers within the loop to
>store my array and update it each iteration? (I had a few attempts
>after reading the section in the manual but didnt seem to get
>anywhere).
>
>Thanks.
>
>Thomas
0 Kudos
Message 2 of 4
(3,409 Views)
On Thu, 4 Jul 2002 10:19:00 -0700 (PDT), TMC wrote:

>Im using a while loop to build an array (sounds familiar? - I just
>read that post), I init the array outside of the loop and use Insert
>into Array to gather the data inside the loop (for a waveform). The
>other post told me where to look (shift registers) but not how to use
>them.
>
>The user manual has quite a difficult description of how to work with
>shift registers and im just wondering:
>
>Which shift register do I wire the initial array to?
>and
>In what configuration do I wire the shift registers within the loop to
>store my array and update it each iteration? (I had a few attempts
>after reading the section in the manual but didnt seem to get
>anywhere).
>
>Thanks.
>
>Thomas


There are two wa
ys to build an array with a WHILE loop.

1. Use a WHILE loop's indexing ability to create the array. You do
this by wiring the data to the edge of the WHILE loop and right click
to select Enable Indexing. Right click again to create an Indicator.
The indicator created should be an array.

2. Use shift register and the build array element. The advantage of
this is that you can view the contents as it is updated. Wire the
incoming shift register to the build array element. Right click and
change the first input to Array Input. Add a second input which is a
scalar input (i.e. not an array). Wire the output of this build array
element to the outgoing shift register. Connect an empty array to the
incoming shift register.

Hope that helps. LabVIEW is such a visual language it is hard to
explain sometimes.

Linda
Message 3 of 4
(3,409 Views)
Thomas,
I put together a quick example showing the two ways to create an array using a For Loop. One shows the shift registers updating the array for each iteration, the other uses the Indexing feature of the For Loop (or While Loop) to build it as you go and display it after the loop stops executing. This should give you something to look at in reference to the other posts. Hope this helps!

Jim Cahow
Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(3,409 Views)