Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

measuring pulse width

Hi,
I'm trying to use the counter to measure pulse widths. I need to be able to get the result zero, i.e., the duration of the pulse might be shorter than the time between two consequent ticks of the clock I'm using. Can the counter return the result of width zero? In my application Labview plots error- 200140 suggesting that I might should use a faster counter timebase. It seems to me that this happens when zero should be returned. Am I correct, or the error stems from a different problem?
I would like also to know what are the roles of the minimum value and maximum value that needed to be fed to the counter.

Thanks,
Offir.
0 Kudos
Message 1 of 3
(3,917 Views)
Hi Offir,
 
I would suggest that you try the example finder in LabVIEW and see if there are any examples there that work with your application.
Meas-Duty-Cycle_buffered-Finite.vi
&
Meas-Pulse-Width-Buffered-Cont.vi
These along with the other counter examples might be able to do as you wish.
You can find these by going to the example finder and browsing to >>Hardware Input and Output >> DAQmx >> Counter Measurements and either
a) >> Count Digital Events
or
b) >> Digital Frequancy
or
c) >> Period or Pulse Width
 
Handeling the error might not be possible due to the fact that the error is sometimes associated with the task and so clearing the task might not always work.
 
Give these a go?
 
Thanx
 
AdamB
Applications Engineering Team Leader | National Instruments | UK & Ireland
0 Kudos
Message 2 of 3
(3,908 Views)

Under DAQmx, there's a property called "Duplicate Count Prevention" that can be set to return a count of 0 when there are 2 consecutive "gate" (sampling clock) edges without any "source" (timebase) edges in between.  There've been several discussions about it here in the counter forums so you can search to find out more.

My own usage and my recollection of prior discussions has focused on buffered period/freq measurements.  I suspect it works similarly for pulse width measurement, but am not 100% sure.   Similar comment regarding unbuffered measurement.

The role of the min and max values is to let DAQmx decide what internal timebase to use for the measurement.  If you need to resolve very long pulse widths, it'll need to use a slower timebase to avoid counter rollover.  Otherwise, I don't know exactly how it decides which one to use.  I typically use a DAQmx property node to set it explicitly because I was always used to thinking that way from traditional NI-DAQ.

-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.
0 Kudos
Message 3 of 3
(3,901 Views)