Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

USB-6211 count edges during gate

Solved!
Go to solution

pulses.png

 

I'm attempting to use a USB-6211 to count signal pulses within an external gate, as shown above. I'll refer to my blue pulses as my gate and orange pulses as my signal. I want to count how many orange rising edges there are during the positive excursion of each blue pulse. I've tried several approaches and need help understanding what I've seen.

 

I'm wondering if perhaps my goal isn't possible with the USB-6211---if somebody could just confirm that this IS possible with my hardware I would feel better about sinking more time into trying to figure out how to configure the task.

 

Any response would be appreciated!

 

I'm using PyDAQmx on Windows 10 with DAQmx version 20.1---scripts attached.

 

APPROACH ONE: edge counting

 

I can setup a count edges channel using my blue gate pulses as an external sample clock. This gives me the number of orange signal pulses between rising edges of my gate, but tells me nothing about how many orange signal pulses appeared during the positive excursion. I have tried two strategies to stop counting while my blue gate is low, but both have failed.

 

I have tried activating the hardware counting gate that's documented in the USB-6211 manual (CI.CountEdges.Gate.Enable), but DAQmx tells me "Specified property is not supported by the device or is not applicable to the task".

 

I have tried adding a pause trigger, but DAQmx tells me "Pause trigger is only valid for event counting if sample clock is not used"

 

APPROACH TWO: pulse width measurement

 

From reading other community posts, I have seen that it's possible to back-out the value that I want by doing a pulse width measurement using my signal as an external time-base. I have tried this, but DAQmx tells me "Device does not support this property"

 

Download All
0 Kudos
Message 1 of 3
(1,802 Views)
Solution
Accepted by topic author uw-blaise

Pulse width is the way to go.  I don't know the Python API at all, but it looks like you've only defined the blue pulse signal as "PFI3".  (You might need to be more explicit and refer to it as "/Dev2/PFI3", making note of the leading '/' character.)

 

You'll also need to configure the orange pulse signal to be your counter's "Timebase Source".  You'll again use a syntax similar to "/Dev2/PFI4".

 

Once you get that going, you may find that you want to measure *every* pulse width.  For that, you'll need to configure your task to do buffered acquisition.  In LabVIEW, the function is called DAQmx Timing.  You'll designate "Implicit" timing because the signals themselves define the rate at which measurements happen (1 measurement per high interval of the blue signal).  I'll suggest that you also designate finite sampling so that the "number of samples" will set your buffer size.

 

 

-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 3
(1,755 Views)

Thanks so much Kevin! You gave me the push to figure out the correct configuration.

 

Working script attached.

0 Kudos
Message 3 of 3
(1,720 Views)