An uninitialized shift register stores values from one call to a subVI the next. If a program contains multiple levels of VIs, higher-level VIs "call" subVIs to perform certain operations when the program executes or runs. A subVI may be called multiple times during a program execution.
Use uninitialized shift registers to store a run count or other similar information about the execution of a program. Shift registers store values between executions. Whether a VI runs normally or is aborted, shift register values remain.
Suppose you need to count how many times a given event occurs during an execution. You can use an uninitialized shift register in a subVI and increment the shift register value each time the loop is called, but when you run the VI a second time, the count will pick up where it left off in the first execution.
To solve this problem, you must include a special call to the for or while loop that resets the loop to zero in your higher level VIs.
This example demonstrates how to build a shift register that stores its value between calls to the subVI, but not between full executions of the VI hierarchy.
| Related Links: |
| Application Design Pattern: State Machines |