12-01-2008 02:27 PM
Good afternoon:
I'm kinda stuck on how to put this together: I need to time out 24 hours, 1 loop per hour. Each hour/loop iteration, I will need an output (out of the loop) to activate a particular sequence. I cant figure out how to get the loop to either 1) put out an iteration value per (ie 1,2,3...24, reset, 1,2,3...24) or 2) reset each hour to deliver an iteration of 1 (1,reset,1,reset,1...) then I would add to it externally to figure out where I am in a 24 hour period. I have been sorting through the examples and a lot of the previous discussions, but cant seem to get my head around it.
I appreciate the help
Sig.
Solved! Go to Solution.
12-01-2008 03:14 PM
Please post what you have so far.
You could use the Quotient and Remainder function on the loop iteration terminal to divide by 24. The remainder would be 0 through 23 then reset on each iteration.
But one loop iteration per hour is rather slow. If you hit the stop button on your program, you might have to wait for up to two hours for it to stop. Rather than counting loops, it would probably be better to use the Elapsed time Express VI, or use your own Get Date/Time function in the loop and determine when an hour has passed to execute the code then.
12-01-2008 03:17 PM - edited 12-01-2008 03:19 PM
Sig,
Here is one way to get a 1-24 count from loop iteration count.
Looks like I was a bit slooooooooooooooooowww.
12-01-2008 03:57 PM
12-01-2008 04:34 PM - edited 12-01-2008 04:35 PM
Instead of multiple comparisons, create a case structure with 3 cases. The input would be the integer counter. The first case would be 2,4,6,8,10,12,14,16,18,20,22, the 2nd case would be 1,9,17, the 3rd case would be 24. A 4th would be default and contain nothing, and should probably never run.
12-01-2008 05:27 PM