Shift register

From LabVIEW Wiki
Jump to: navigation, search

A Shift Register is a construct on For Loops and While Loops that pass data from one iteration of the loop to the next iteration of the loop. This is accomplished by wiring the output into the right shift register and then using the left shift register as input to the code executed inside of the loop. The left shift register can have one or more terminals. These terminals act as a buffer, filling the top-most terminal with the value from the most recent iteration and pushing the values of previous iterations down.

Uninitialized Shift Register

An Uninitialized Shift Register is a shift register of either a While Loop or For Loop that has no input data wired to the shift register's left terminal from the outside of the loop. Since the shift register is not initialized, the data that flows out of the shift register:

  • on the first time the loop is called, is equal to the default value of the shift register's data type, and
  • on subsequent calls, is equal to the value that flowed into the right terminal of the shift register, on the previous call of the loop.

This behavior means that the shift register can be used to store some data that will be remembered from one call of the loop to the next. This technique is used for creating Functional Globals.