Adding a While Loop
- Updated2024-05-10
- 2 minute(s) read
Adding a While Loop
Add a While Loop to continuously generate the signal and check the generation status until you click the Stop button.
-
Display the VI block diagram, and select the While Loop on the Structures palette.
Tip You can use the Search button on the Functions palette to find the Structures palette.
-
Enclose the niRFSG Check Generation Status VI in the While Loop, as shown in the following figure.
Figure 7. The niRFSG Check Generation Status VI Enclosed in the While Loop 
- Right-click the While Loop tunnels, and select Replace with Shift Register.
- Select the Or function on the Boolean palette. Place the function inside the While Loop.
- Wire the output of the Or function to the conditional terminal of the While Loop.
- Select the Unbundle by Name function on the Cluster, Class, & Variant palette. Place the function inside the While Loop.
- Wire the error out output of the niRFSG Check Generation Status VI to the Unbundle by Name function.
- Wire the output of the status element to an input of the Or function.
- Right-click the unused input of the Or function, and select to create a Boolean control.
-
In the VI front panel, right-click the Boolean control created in step 9, and select
to create a
Stop button.
Figure 8. While Loop with Stop Button 