LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Want to toggle an output on and off every minute

Solved!
Go to solution

Hi All,

 

What's the easiest way to setup a loop so that an output is toggled on/off every minute?

 

 Thanks.

0 Kudos
Message 1 of 8
(4,062 Views)

Use the wait for next multiple (ms) function.

 

Felix

0 Kudos
Message 2 of 8
(4,060 Views)
OK, I still don't understand how to wire it up so it will toggle each cycle through the loop?
0 Kudos
Message 3 of 8
(4,052 Views)

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.

Cory K
0 Kudos
Message 4 of 8
(4,051 Views)

Hi sean,

 

this is really very basic:

loop.png

 

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...

Message Edited by GerdW on 09-07-2009 09:50 PM
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 8
(4,047 Views)
Solution
Accepted by topic author sean m

Heres one way to do it

 

timed.png

 

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.

Cory K
Message 6 of 8
(4,047 Views)

Look attachment (this).

 

 

Felix

 

Edit: Heavy traffic, beaten by two...

Message Edited by F. Schubert on 09-07-2009 02:54 PM
0 Kudos
Message 7 of 8
(4,040 Views)

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.

0 Kudos
Message 8 of 8
(3,986 Views)