For starters, let us look at how to create a shift register. Right click on the left edge of a for or while structure and select "Add Shift Register":


Below, a numeric control terminal is wired to the shift register. Whatever value is typed into the control on the front panel will appear as an output on the left square on the next iteration:



This example will retain the previous value of the shift register on the output and to the next iteration if the boolean control is set to false. If it is set true, then the value of the numeric control will be placed onto the shift register. This code will act as a latch, saving the value in the numeric control when the boolean control is on, while retaining the old value and not following the numeric control value when the boolean control is off.
As you move forward with LabView programming, you will see that most design patterns are impossible without the shift register. Anytime you are trying to keep track of something in a loop, you will need to use one.
No comments:
Post a Comment