LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

initialize shift register

Solved!
Go to solution

Hi,

 

How do you intialize the shift register (inside the second for loop) so that it starts from 0 everytime the program runs. I have tried attaching a 0 constant to the left shift register, but that just resets the register every time it goes through the inner loop.

 

Thanks

0 Kudos
Message 1 of 5
(7,630 Views)
Solution
Accepted by topic author mnanda98
If you only want to reset it once at the beginning, and not for each iteration of the outer for loop, you need to add another shift register on the outer for loop and wire the 0 to that shift register.

LabVIEW Champion, CLA, CLED, CTD
(blog)
Message 2 of 5
(7,624 Views)

It is not completely clear exactly what you want it to do. You may need an additional shift register on the outer loop. Initialize that to zero. Inside the outer loop wire the inside left terminal to the outside left terminal of the inner loop shift register and similarly wire the outputs.

 

Lynn

Message 3 of 5
(7,622 Views)

You haven't included the rest of your program, so it's hard to tell. You need to set the value on the farthest out loop because everything inside the top level loop will get reset unless you pass that memory space from iteration to iteration.

LoopsInLoops.png

 

 

Follow the dataflow to really understand why you need to do it this way. 

LabVIEW programming is based entirely on dataflow and parallelism. This is incredibly powerful and has lead to its success over the years (coupled with the graphical programming), but is usually one of the first things that new developers stumble over. Here's a simple resource to become more familiar with how it works. The Highlight Execution feature is a great way to watch how your application utilizes dataflow.

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 4 of 5
(7,613 Views)

There are other ways to do this as well if you really want to avoid data being passed outside your little loop. You can get fancy with a feedback node and an initialization terminal, or your can use a First Call? boolean.

LoopsInLoopsInLoops.png

Cheers


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'


Message 5 of 5
(7,590 Views)