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.
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:
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.
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.
Create a numeric constant outside of the while loop and wire it to the border of the loop.
Right click on this tunnel and select Replace with Shift Register.
Place a boolean control on the Front Panel. This is our reset button that will reset the shift register in the while loop.
Wire the boolean control to the Case Selector of the case structure.
In the True case, place a numeric constant of zero and wire to an output tunnel on the Case Structure.
In the False case, wire the data through to the output terminal.
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.
Thank you for your feedback.
You changed your response to Not Helpful
You changed your response to Helpful
Collaborate with other users in our discussion forums
A valid service agreement may be required, and support options vary by country.