09-03-2009 03:09 PM - edited 09-03-2009 03:13 PM
Hi all
My task is: Structure While Loop generates signal for 4 seconds when you press button "start generate", after that data was saved. You press button "start generate" again, and the loop does one again.
My problem is: the first pressing, the loop does exactly 4s (3,999s), but the secondly, thirdly pressing.... Elapsed time is not 4 seconds, always smaller (even ~ 0.003s). The Loop only works properly after pressing button "Exit" and launch program again.
How can I control exactly time work of Structure While Loop without pressing button "Exit".
Thank you any help!
P/S: I used Tick Count (ms) simply for viewing time of working of the While Loop.
NMCuong
Solved! Go to Solution.
09-03-2009 03:23 PM
09-03-2009 03:53 PM - edited 09-03-2009 03:57 PM
Hi billko
Did you run my program I attached? I'm sure the loop incorrectly works. For easy, you can increase the Time Taget to 5s, 6s, you will see the difference. Note, plz, that press the button "start generation" for some times while program running.
Thanks
09-03-2009 04:09 PM
I'm sorry, Nguyen:
I have only LabVIEW 7.1 so I cannot run the VI. 😞
09-03-2009 04:21 PM - edited 09-03-2009 04:23 PM
09-03-2009 04:51 PM
You need to reset the Elapsed timer after the first time.
Use a shift register to pass a True into the while loop but then feed in a false in the right side shift register.
Each time you press Start generation it will reset the timer
The times then were almost =
4.01
09-03-2009 04:57 PM
This shows a quick fix
09-03-2009 10:17 PM
OK, thank everyone. The Loop well works now.
NguyenMC