05-26-2010 01:33 PM
Hello
I'm trying to see if anyone has any ideas on how to improve this simple 2 minute countdown timer. All suggestions are welcome!
Thanks in advance!
-noviceLabVIEWuser
Solved! Go to Solution.
05-26-2010 01:45 PM
Only minor modification to the logic, major modification is adding a wait to the while loop. No need for this to be a CPU hog.
05-26-2010 01:50 PM
As an alternative, I used a case structure to eliminate some calculations for Sample Time while Air Time is counting down and vice versa. I don't know if this is necessarily better. Your original code was simple and it worked fine.
False case showing: True case showing:
05-26-2010 02:09 PM
If you are never going to change the time limits, you could extend tbob's idea further by converting the elapsed time to an integer and connecting the integer to the selection terminal. Then change the cases to "..60, Default" and "61..120". You do not need the comparisons. However, changing the time limits requires a change to the code, not just to the value of a constant.
I would also place each constant only once and wire all uses of it to that one instance. Then if you ever need to change the limit, it only needs to be changed at one place. It is very easy to miss one of three or four copies of a constant.
Lynn