Skip to content
Home » Blog » Using Shift Registers in LabVIEW

Using Shift Registers in LabVIEW

Delve into the world of LabVIEW programming as we demystify the use of shift registers. Our guide takes you through the intricacies of incorporating and configuring shift registers, providing LabVIEW beginners with valuable insights. Discover how these dynamic tools facilitate the seamless transfer of data across loop iterations, empowering you to optimize your LabVIEW applications with precision and control. Start your journey to mastering LabVIEW programming by harnessing the potential of shift registers.

When working with loops in programming, there is often a need to reference data from previous iterations of the loop. In LabVIEW, you can utilize shift registers, akin to static variables in text-based programming languages, to transmit values from one iteration of the loop to the next.

Once the loop code is executed, data enters the right shift register and is subsequently conveyed to the left shift register during the subsequent iteration of the loop.

This tutorial elucidates the process of incorporating and configuring shift registers in LabVIEW. It is advisable to acquaint yourself with information on LabVIEW For Loops and While Loops before proceeding with this tutorial. Geared towards LabVIEW beginners, this tutorial is an excellent starting point. If you seek additional resources on LabVIEW fundamentals, consider exploring the Introduction to LabVIEW getting started material.

Follow these steps to implement shift registers in LabVIEW:

  1. Launch LabVIEW and initiate a new VI by navigating to File » New VI.
  2. Place a numeric control on the front panel (Controls >> Modern >> Numeric >> Numeric Control) and set its value to 2.
  3. Double-click on the control’s name and rename it as “Initial.”
  • Introduce a numeric indicator on the front panel (Controls >> Modern >> Numeric >> Numeric Indicator) and label it as “Result.”

Now, proceed with the following steps on the block diagram:

  1. Display the block diagram by selecting Window » Show Block Diagram or pressing <Ctrl-E>.
  2. Integrate a for loop on the block diagram (Functions » Programming » Structures » For Loop) between the numeric control and the indicator.
  1. Right-click on the count terminal input of the for loop, select Create Constant, and set the constant value to 2.
  2. Connect the output of the Initial control to the right edge of the for loop to establish a tunnel.
  3. Right-click on the newly created tunnel and opt for Replace with Shift Register.
  1. Wire the output of the right shift register to the Result indicator.
  2. Insert a multiply function within the for loop (Functions >> Programming >> Numeric >> Multiply).
  3. Add a numeric constant inside the for loop (Functions >> Programming >> Numeric >> DBL Numeric Constant), assign it a value of 3, and connect it to one of the input terminals of the multiply function.
  4. Connect the left shift register to the remaining input of the multiply function and link the output of the function to the right shift register.

To run the VI, follow these steps:

  1. Show the front panel by selecting Window » Show Front Panel or pressing <Ctrl-E>.
  2. Execute the VI. The Result indicator value will change to 18.

Shift registers play a pivotal role in this VI. To comprehend the VI’s functionality, step through the code:

  1. The for loop runs twice due to being wired to a constant count of 2.
  2. During the first iteration, the Initial value of 2 is multiplied by 3, yielding 6, and this result is passed to the right shift register.
  3. In the second iteration, the left shift register receives the prior result, 6. It is then multiplied by 3, resulting in 18.
  4. Upon completing all iterations, the for loop stops running, and the value of 18 is transmitted to the Result indicator on the front panel.

The mathematical formula for this simple VI can be expressed as:

Result=((Initial×3)×3)Result=((Initial×3)×3)

If the count terminal of the for loop is adjusted to 4, the formula becomes:

Result=((((Initial×3)×3)×3)×3)
Result=((((Initial×3)×3)×3)×3)

1 thought on “Using Shift Registers in LabVIEW”

  1. Pingback: Boosting Performance: Unleash the Power of Shif...

Comments are closed.