Reinitializing a Shift Register Without Stopping the VI

Updated Jul 20, 2018

Reported In

Software

  • LabVIEW Full

Issue Details

I would like to reinitialize my shift register value to zero whenever I press a boolean button on the front panel. I do not want to stop my VI when I want to reinitialize my shift register.

Solution

This can be done by adding a case structure within the while loop as follows, or by dragging the VI snippet to your block diagram if you are running LabVIEW 2013 or later:

  1. In order to select a while loop right click on the block diagram then navigate to Programming>>Structures>>While Loop and drag it onto the diagram.

  2. In order to select a case structure right click on the block diagram then navigate to Programming>>Structures>>Case Structure and drag a case structure into the while loop.

  3. Create a numeric constant outside of the while loop and wire it to the border of the loop.

  4. Right click on this tunnel and select Replace with Shift Register.

  5. Place a boolean control on the Front Panel. This is our reset button that will reset the shift register in the while loop.

  6. Wire the boolean control to the Case Selector of the case structure.

  7. In the True case, place a numeric constant of zero and wire to an output tunnel on the Case Structure.

  8. In the False case, wire the data through to the output terminal.

  9. Wire the output terminal of the case structure to the shift register on the right side of the while loop.

    Figure 1. Reinitializing a shift register without stopping the VI.

WAS THIS ARTICLE HELPFUL?

Not Helpful