LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I use a digital on change event to trigger the start of a pulse width measurement using a counter?

Is this something that can be done? I have a continuous stream of digital pulses and I need to measure the width of every one. The width of each pulse is .75 seconds and 50% duty cycle. Currently I'm using a VI from "JJ Controls" called "micro_clock. I start the timer when I detect a pulses leading edge and on the falling edge I get the time in microseconds. This works fine but not it's not stable enough. Seems the timing can be disturbed by anything the windows operating does in the background. I am currently looking to use a counter instead for better accuracy and stability in my measurements. There is an example I found on here that is close to what I want but I don't like the idea of putting in a 1500ms delay after the DAQmx Start VI. The VI is called "Measure Single Pulse DAQmx86.vi" I have attached it to this post. My DAQ is a USB-6341 and is capable of utilizing digital onchage events. I haven't been able to figure out if I can use the Digital Input OnChange event to trigger a Counter Pulse width measurement or if it's even feasible to do it.

Thanks for any help!

 

0 Kudos
Message 1 of 3
(2,652 Views)

This kind of thing is much better suited to solve by hardware than software.  The counters in your X-series board can buffer up a continuous stream of pulse width measurements, capturing widths on all pulses coming in, no need for fast reaction time from software.

 

I tweaked your posted program a little bit to illustrate.  The single most important thing I changed was to set up a buffered measurement by calling "DAQmx Timing.vi".  I told it to measure pulse widths of an internal signal (the 100 kHz timebase) and when I tested on an X-series board here, I got uniform measurements of 5 microsec.  This is exactly as expected since the timebase is a 10 microsec pulse train with 50% duty cycle.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 2 of 3
(2,614 Views)

Thanks I greatly appreciate your help. I will try you changes out and see if I can work with it.

My Actual VI is pretty complicated as it is doing several analog measurements, counting pulses during a 7.5 second timeframe, and measuring the width of every pulse. The VI is proprietary as it is for the testing of aircraft exterior lighting that flashes every 1.5 seconds. So, my measurements have to be exact, because of the requirements put forth by the aircraft manufacture.

0 Kudos
Message 3 of 3
(2,597 Views)