Re: how can a control for true/false be changed while program is running



You need to take a tick count before entering the loop, then another tick count at every iteration inside the loop. The difference will tell you the elapsed time that you can compare with the threshold. If you need to be able to change the timeout during the run, the terminal should go inside the loop too. Modify as needed.
 
<img src="http://forums.ni.com/attachments/ni/170/143283/1/timed_stop.png";>
Of course in a more general case, you would add another button or local variable and use logical OR between them so the loop can also be stopped either with the timer or manually as needed.Message Edited by altenbach on 09-19-2005 11:13 AM


timed_stop.png:
http://forums.ni.com/attachments/ni/170/143283/1/timed_stop.png
.



Relevant Pages

  • Re: Exiting a windows Program?
    ... Using a forloop as a timer is a really bad idea. ... Brian ... Prev by Date: ...
    (microsoft.public.vc.language)
  • Re: Delay or suspend Application waiting for thread to complete
    ... If I use a loop that includes a ... call to Application.ProcessMessages, all processes, including the timer and ... Prev by Date: ...
    (comp.lang.pascal.delphi.misc)
  • Re: Using queues with DAQ cards and general programing???
    ... Similar to what I said for A. Destroy the task when you leave the loop. ... Add a wait timer in all loops so they do not run too fast and goble up all of the CPU. ... Prev by Date: ...
    (comp.lang.labview)
  • Re: Calling a procedure with loop
    ... would this not be better in a Timer ... >ProcName; ... >but break out of the loop without looping. ... Prev by Date: ...
    (alt.comp.lang.borland-delphi)
  • Re: question about thread scheduling
    ... I will try what you suggested, the reason that I didn't use the sleep method ... whatsoever to tamper with the timer tick. ... If the NN run in a different thread as the control loop ...
    (microsoft.public.windowsce.platbuilder)