LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Digital Output with Specific Frequency

I am trying to use a NI USB-6251 BNC to trigger an LED at a desired frequency. Ideally I would like to have on and off states of that frequency. For example, ~ 20Hz for 5 ms, and then off for 1 minute. I do not believe I can use a counter with the device and I am trying to control the device with a BNC to BNC digital connection.

 

I am using LabView 8.6 with a Windows 7 OS. I have one example that I am currently working with. This example allows me to trigger the light on and off at a constant frequency.

 

Any help or advice on how to modify the VI would be very much appreciated.I am new to this software and have been looking at examples and tutorials without much luck.

 

Thank you.

0 Kudos
Message 1 of 6
(4,303 Views)

Have you tried to turn the DO on/off in a timed loop?  

------------------------------------------------------------------

Kudos and Accepted as Solution are welcome!
0 Kudos
Message 2 of 6
(4,297 Views)

I'm not sure exactly what your requirements are. Firstly I am confused by the idea of toggling the state at 20Hz for 5ms. You cant toggle a boolean at 20Hz (20Hz = 50ms)  in less than 5ms (5ms = 200Hz)

I have written a quick demo (image attached) which illustrates how you can have a two stage timer where the digital output can change state at 20Hz for 5 seconds and then stay off for 60 seconds. If you were to put this code into another while loop you would have the following functionality...

1.LED blinks at 20Hz for 5 seconds

2. LED stops for 60 seconds

3. Goto Step 1!

 

This example is of course software timed and drives a LabVIEW LED rather than an output line but I hope it illustrates the approach.

 

 

Hope this helps!

Dave.

 

Two Stage Timer.PNG

Senior Software Engineer
www.Adansor.com
0 Kudos
Message 3 of 6
(4,289 Views)

Thank you for the very helpful information. I am sorry for the confusion regarding the frequency of the pulses. I was hoping to explain that I had only wanted the light to pulse at specified frequency for a given amount of time (as opposed to continuous), then stop. However, you have cleared that up for me with having the two elapsed time functions.

 

I would like to present pulses of the light using an external driver, so I will need to have digital output. I have tried to recreate the block diagram (in hopes that I could eventually figure out how to drive output instead of the LabView LED), but came across two questions. First, my light is constant. I do not believe it is blinking. And secondly, it is not repeating the loop. Are there any obvious errors in the attached VI?

 

Thank you again!

0 Kudos
Message 4 of 6
(4,278 Views)

Hello again!

 

I spotted the problem pretty quickly, its a common mistake and one that I make on a regular basis!...the boolean tunnels inside the inner while loop need to be changed into a shift register or the LED state will not change.

 

The first timer needs to be reset each time the inner while loop executes so I have added another shift register to handle that, the reset only has to be true once on the first iteratio of the inner while loop.

 

I changed the quit mechanism so that you dont have to wait until the inner loop finishes executing before the program stops.

 

Best regards,

Dave.

missing shift register.PNG

Senior Software Engineer
www.Adansor.com
0 Kudos
Message 5 of 6
(4,260 Views)

Sorry to stealing this thread but I'm completly new in Labview(started yesterday) and have this problem: I have manually added two switches on front panel to open and close valves(step by step tutorial). I would like to make this automatic, so that they open and close with frequeny of 5 Hz. So, channel(line) 4 opens(gives signal to electromagnet 1) which puts valve in position 1. When the valve is completly opened, channel 4 shuts off(so does electromagnet), and the channel 6 opens(gives signal to electromagnet 2) which puts valve in position 2(starting poisition) and the cycle repeats (10 times).

Would anyone be so kind and give information on which funtions to use?

I attached the program.

 

Thanks in advance!

0 Kudos
Message 6 of 6
(4,191 Views)