LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

timer to generate on/off signal every 20 mins for 10 sec

I need to create a simple timer. It comes on every 20 minutes for 10 seconds, then switches off until another 20 minutes has passed, and so it repeats itself. I want to open a valve with this every 20 mins for 10 secs, then close it. This is to work with a field point device that we have on our shelves.
0 Kudos
Message 1 of 8
(5,454 Views)
Mike,

Create a while loop with a shift register. Outside the loop read the time of day clock when you start the process. Use that time to initialize the shift register. Inside the loop read the clock and compare to previous value in shift register plus 10 seconds. When current time is greater than that threshold toggle a boolean and update the shift register. Then look for shift register plus 20 minutes (1200 seconds). Repeat. Use the boolean to control your valve driver.

Lynn
0 Kudos
Message 2 of 8
(5,453 Views)
I to am working on a similar project. I am controlling 10 engines indepandently and need to cycle each. Each engine will be on for 3 hours and then I need to turn them off for 30 mins. I am VERY new to Labview and its programming. I would be interested in any ideas and examples that may be out there.


Thanks,
Vern
0 Kudos
Message 3 of 8
(5,440 Views)
Thanks for that. I am fairly new to LabVIEW, particularly the hardware part. I shall have a go at your suggestion. Many thanks, I'll let you know how I get on.

Regards

Mike
0 Kudos
Message 4 of 8
(5,432 Views)
Hello

Try "timed loop". (examples in Labview). You can control time on, off and syncronize different loops as neccesary( priority, delays. etc).

Cheers
Alipio
---------------------------------------------------------
"Qod natura non dat, Salmantica non praestat"
---------------------------------------------------------
0 Kudos
Message 5 of 8
(5,426 Views)
Here is a simple solution.
Create a while loop, inside the while loop put a sequence in step 1 place a wait vi and set the value to 20 min (remember this input is in ms so 20 min = 1200000) in step two place the code to send the on signal (hardware output I assume) in the third step of the sequence place another wait for 10 seconds (10000 ms) and finally place the off sequence last. This solution is very processor friendly. If you just compair time stamps inside a loop, the loop will be continiously checking the time and your CPU use will max out. You can place an inherent wait in the loop but the responsivness (accuracy of your timming) will be reduced. The wait statment will pause your program until the timer (I believe it is linked to the OS interupt system) expires. This solution allows for multiple threads (loops) to run cuncurrently with little extra overhead. I have used timers to generate alarms in the past where the sequence after the time expiring fires an occurance to drive code in other loops. Hope this helps
-Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 6 of 8
(5,426 Views)
Hello everyone. Thanks for all your suggestions. In the end, I used a combination of the ideas. I used the Flat Sequence Structure in LV and the Elapsed Time express VI's to generate two separate timing loops that ran sequentially. The whole thing was placed in a while loop so that the process repeats itself until I use a local STOP variable to stop the timing circuits. I still need to fiddle with it so that after stopping the timing circuits, they reset to zero elapsed time and then can be switched on again without having to stop the entire program. This is becase I have anothe loop running in the same programme that measure a pressure signal, and that needs to be on all the time. Many thanks to you all,

Regards

Mike
0 Kudos
Message 7 of 8
(5,368 Views)
Mike,

Add a case statement that initializes the timers to zero when you call the VI. Use a shift register with a boolean variable initialized to False. It controls the case selector. Inside the False case initialize the timers and set the boolean to True. The True case does nothing except pass the boolean through.

Lynn
0 Kudos
Message 8 of 8
(5,356 Views)