
Mechanical Action + Keyboard Control
Quote:
>I have a data acquisition while loop which is fairly slow (2 seconds per
>'while'). If a user presses a stop button attached to the while loop, I
have
>to set the button to latch to get reliable stopping (since the users tend
to
>press the button and then release it whilst the data acquisition is still
>underway). However, once stopped, if the user runs the VI again the button
>is still latched, so the VI doesn't run.
As I see this problem, I see two separate processes. One is to scan data at
a 2 second rate and the other is to look for the stop function at perhaps
100 ms rate. One solution is to create two while loops and connect them
together with an occurrence. The button process would simply loop and read
the stop function which is set the mechanical action to "latch" and if true
then set the occurrence and also stop that process. The button will reset
itself back to the false state after the control is read by LV at the
terminal so it is guaranteed to always be false when the vi starts. The
other data scan process could then use the Wait on Occurrence with the
timeout wired to some small positive value. The output "timed out" would
then be wired to the while loop termination icon. If the Wait times out
(true), it means that the button was not pushed and the process goes and
gets more data. If it is false, it means that the stop button was pushed
and the data scan process will terminate.
Hope this helps
Bob Hopkins