To download NI software, including the products shown below, visit ni.com/downloads.
Overview
Coding that shows the difference of controlling the timing of a loop with an event structure.
Description
This VI shows the difference in two different methods of exiting a loop with a long wait function. For this particular VI, the first method has the boolean aside a wait function. This method has to wait the 5000 ms before it even passes the boolean to the stop of the loop. The other method uses an event structure with a 5 second timeout that looks for an event change of the stop button. When the stop button is pressed, it immediately breaks out of the loop. The user can see that these two methods function exactly the same when just watching the VI run, but once the VI is needed to be stopped, the event structure is much more efficient.
Requirements
LabVIEW 2012 (or compatible)
Steps to Implement or Execute Code
1. Select one of the two methods that can be used to stop the while loop,either the normal method of writing a value to the condition terminal or the method that utilizes the event structure
2. Run VI
3. When you press Stop, the behavior exhibited should be different for each method.
Additional Information or References
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.