09-07-2009 02:14 PM
Hi All,
What's the easiest way to setup a loop so that an output is toggled on/off every minute?
Thanks.
Solved! Go to Solution.
09-07-2009 02:28 PM
Use the wait for next multiple (ms) function.
Felix
09-07-2009 02:41 PM
09-07-2009 02:41 PM
You can either use 'wait for next multiple' in a while loop and specify how often you want the code to operate.
Or you can put all the code in a case structure, and use the current ms time for some boolean logic.
But I think the first option is a little easier.
09-07-2009 02:48 PM - edited 09-07-2009 02:50 PM
Hi sean,
this is really very basic:
I would suggest you to visit the Academics section of NI's website to attend the free online LabView courses they offer!
Edited:
Instead of 1000ms you should wait for next 60000ms multiple. Or use an inner for loop, that waits 1000ms 60 times...
09-07-2009 02:48 PM
Heres one way to do it
Just check if the elapsed time is a multiple of 2 minutes (ie is divisible by 120 seconds with no remainder).
If thats true, run the case structure.
***Note this is only example code, your while loop should have a wait in it.
09-07-2009 02:51 PM - edited 09-07-2009 02:54 PM
Look attachment (this).
Felix
Edit: Heavy traffic, beaten by two...
09-08-2009 01:25 PM
Thanks guys, I was able to get it working by doing a modulus 60 on the system tick count.
Thanks again for the good responses.