Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

NI USB-6001 Counting Edges to Pulse Time

Hi all,

 

I made a counter with NI USB 6001 as following:

kellytran_1-1602259740611.png

 

From counting edges, I can get the frequency.

Is there any way I can get PW (Pulse Width) or Duty Cycle from counting edges or from this device?

 

 

Thank you.

0 Kudos
Message 1 of 5
(3,045 Views)

Briefly, no.

 

The 6001 has very limited counter functionality which can only count edges of 1 polarity at a time.  There isn't any way to estimate a pulse width.  You're only real shot would be to acquire the signal with an AI task and post-process the data.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 2 of 5
(2,987 Views)

Thank you for your answer,

 

What if, I can create a while loop to measure the time from counting edge 0 to counting edge 1 in about 1000 samples. Then, I take the mean of all the samples.

Because I know the frequency, I can calculate the period.

Width = Period - (Mean of 1000 samples above)

 

Duty Cycle = (Width / Period) * 100

 

  

0 Kudos
Message 3 of 5
(2,983 Views)

It isn't clear what you mean by edges 0 and 1, but *whatever* you mean, a counter task on a USB-6001 isn't gonna be able to get you there.

 

Meaning 1: edge 0 = rising edge, edge 1 = next falling edge

   Your counter cannot be sensitive to both rising and falling edges in the same task.  You can count rising edges for a while to estimate average frequency or you can count falling edges for a while to estimate average frequency.  But the counter can't tell you anything about the time between rising and falling edges.  And that's exactly the info you'd need to determine a pulse width, which in turn you need to determine duty cycle.

 

Meaning 1: edge 0 = rising edge, edge 1 = next rising edge

   This is what you were already doing.  If you count for a known amount of time, you can get a decent estimate of average frequency.  But since you're only looking at rising edges, you have no way to estimate pulse width.

 

A more capable device (such as an X-series) would let you do such measurements with extreme hardware-level precision.  With the 6001, you can't do them at all with the limited counter.  But again, you could possibly acquire the signal with an AI task on the 6001, and figure this stuff out with some fairly straightforward post-processing.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 4 of 5
(2,980 Views)

Thanks for the answer. I'll be sure to keep an eye on this thread AARP Medicare

0 Kudos
Message 5 of 5
(2,870 Views)