For demonstration purposes, this example Sequence loops through multiple Sub Sequences. The looping is stopped when a "Stop" button is pressed from a custom LabVIEW UI.
To implement this fuctionality, follow the steps below:
1. Launch LabVIEW to create the custom UI if one does not already exist.
- In the custom UI, place a While Loop with a Boolean Control to control the While Loop run state.
- Create an Indicator from the Boolean Control and connect this to the VI's Connection Pane. The VI should resemble the following image.
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your LabVIEW diagram.
2. Save the VI locally and name it "Stop Sequence".
3. Launch the current active version of TestStand.
4. In the
Variables pane, create a new
Local Variable of type
Boolean.
- Right-click on Locals ("MainSequence") and select Insert Local >> Boolean.
- Name the variable "Stop". The Variables pane should now resemble the following image.
5. In the
Setup section of the
MainSequence, place a
Run VI Asynchronously step.
6. This Step can be found under the
LabVIEW Utility menu from the
Insertion Palette.
- The Run VI Asynchronously Step allows the custom UI to run opened while the Sequence file is executing.
7. In the
Step Settings pane, select the
Specify VI... option as shown below.
8. From the pop-up window, select the
Browse For VI... option and select the "Stop Sequence" VI that was just created.
9. Ensure that the B
oolean Indicator from the VI is configured to store it's value in
Locals.Stop, as shown:
10. Enable the
Show VI Front Panel option and then select
OK to close the pop-up window.
11. Place a
Label Step from the
Insertion Palette into the
Main section of
MainSequence. Name this Step "Loop start".
12. Navigate to the
Sequences pane on the right-hand-side, and create a Sub Sequence by right-clicking on some empty space and selecting
New Sequence.
- Name the new Sequence "Sub Sequence".
13. Place a
Sequence Call Step underneath the
Label Step in
MainSequence.
14. In the
Step Settings, configure the following:
- File Pathname should be set to the current Sequence file.
- Sequence should be set to the created Sub Sequence.
15. Switch over to the
Properties tab and select
Post Actions. Configure the following:
- Enable the Use Custom Condition option and enter Locals.Stop as the statement.
- On Condition True should be set to Goto step and <End Group>.
- On Condition False should be set to Goto next step.
16. Repeat steps 13 to 15 to create another Sub Sequence call.
- Note: for this step, ensure that the On Condition False property is set to the Label step (this is "Loop start" in the example). This ensures that the Sub Sequence calls are continuously looped over until the "Stop" button from the VI is pressed.
- The Sequence should now resemble the following image.
17. Navigate to
Execute >> Single Pass and observe that the Sequence loops over the Sub Sequence calls while the LabVIEW UI is running in the background.
18. To stop the Sequence, press the "Stop" button from the LabVIEW UI.