02-11-2010 07:04 AM
I am looking for information on how to use delay's within labview. I am looking to take a pushbutton from the joystick and essentially start a delay timer (0.5 sec) and provide the pushbutton output after the delay to a solenoid.
I have looked through labview help and it is not apparent how to create a timer. I suppose I could use the user watchdog, but I think there is a simpler way using a timer and perhaps a latch or one-shot.
02-11-2010 08:02 AM
The obvious, but not right, solution is to use the "wait" function in LabVIEW. This isn't the right solution because everything inside a LabVIEW loop must complete before the loop can proceed to the next iteration. If you put the wait inside the same loop as you feed the watchdog, the watchdog will get fed once, and then not be fed again until the wait completes and the loop proceeds.
The correct way to do this is store a timer value in a shift register. One implementation: when you first push the button, add your wait time (say, 500ms) to the current millisecond timer value and store that in a shift register. Each time through the loop, see if the current time has reached the value stored in the shift register; if so, your timer expired. Be careful not to use = as the comparison, since it's unlikely that your loop will execute an exact number of milliseconds later.
Someone asked a similar question last year and I posted an example then. You can find it if you dig back through the discussions, but it's a good exercise to try writing your own.
02-11-2010 08:51 AM
See the example I posted on ChiefDelphi
http://www.chiefdelphi.com/forums/showthread.php?t=82255
Omar
02-11-2010 08:58 AM
I suppose if there's already a link to one example, might as well add mine too:
Just to show an alternate way to achieve a similar result.02-11-2010 10:36 AM
Thanks for the information on this. I appreciate it.
I may end up using a variation on the same theme.