LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Shift Register to read previous integer from array

Solved!
Go to solution

Hey folks,

 

Labview novice here asking about shift registers. I went through the tutorials and tried to find as much help as I could before posting, but I think I just don't understand shift register functions as clearly as I should. I need to read integers out of an array, and operate a new-old kind of situation to read the difference in steps between two stepper motor positions. I've attached a photo of what I have now, obviously does not work. I'm looking for any suggestions to do this, or any corrections to my logic.ShiftRegister.PNG

0 Kudos
Message 1 of 7
(3,600 Views)

It looks like you just need to delete the feedback wire.  The shift register takes care of your feedback already.  The first shift register (upper register) will return the value that was just computed in your loop (same as feedback) and the lower one will return the value that was created 2 iterations ago. Hope that helps.

0 Kudos
Message 2 of 7
(3,593 Views)

(Please attach the actual VI instead of a blurry picture).

 

  • What is the point of the inner FOR loops? Looks like they are just glorifiied flat sequence frames, right? Don't use loops unless you actually want to repeat something.
  • I think you want to autoindex the blue array and only use a shift register with a single left output. Now you get the current element from the autoindexing tunnel, which you can feed into the shift regsiter on the right. In the next iteration you get the next value from the autoindexing tunnel and the previous value from the shift register, etc.
  • Your feedback node got autoinserted (bad option!) because you created a cycle. Don't go in and out of the loop, simply use the scalar from the autoindexing tunnel.
  • Once you autoindex, you no longer need to wire the N of the outer FOR loop.
  • You could also subtract the blue array from a subset shifted by one position and autoindex on the result. No shift register needed in the loop.

 

 

 

 

0 Kudos
Message 3 of 7
(3,573 Views)

Are you supposed to be iterating through those array elements?  Then use an Autoindexing Tunnel instead of the shift register.  Get rid of that feedback node.  Instead, you want the feedback node to be INSIDE of the loop.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 7
(3,569 Views)

altenbach wrote:
  • You could also subtract the blue array from a subset shifted by one position and autoindex on the result. No shift register needed in the loop.

Here's what I had in mind.

 

 

 

Message 5 of 7
(3,557 Views)
Solution
Accepted by topic author MarkyMark1221

altenbach wrote:
  • I think you want to autoindex the blue array and only use a shift register with a single left output. Now you get the current element from the autoindexing tunnel, which you can feed into the shift regsiter on the right. In the next iteration you get the next value from the autoindexing tunnel and the previous value from the shift register, etc.

Here's an example for that suggestion.

 

Message 6 of 7
(3,547 Views)
awesome altenbach, that makes sense. that works perfectly. thanks for the help!
0 Kudos
Message 7 of 7
(3,530 Views)