Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

HW counter with an acquisition time measured by the HW clock

I would like to count a number of digital events with the hardware counter on my NI data acquisition card.

The integration time has to be quite precise (say a few milliseconds +/- a few microseconds), meaning that I would like to rely on the card's hardware clock rather that on the clock provided by the OS.

 

I think that I managed to do this by creating a Counter task in Measurement & Automation, selecting the 100kHz hardware clock and acquiring a large number of samples at this frequency. I then pick the right element from the array of samples according to the desired integration time, using the formula:

Sample index = [Integration time] x [Clock frequency] + 1.

See the attached drawing for an illustration of the simple VI that I created for this.

 

It seems to work nicely, but in terms of performance and hardware usage it doesn't seem right to take so many samples to get just one value.

Isn't there a simple way to tell the hardware counter to acquire digital events for a given duration (measured precisely by the card's hardware clock) and return the answer ?

0 Kudos
Message 1 of 4
(2,767 Views)

You could do this by creating a sample clock with the *other* counter with a rate corresponding to your precise integration time.  Then your task will buffer cumulative APD counts with hardware-level timing for the intervals represented by each "bin" of counts.

 

There's even a way to define a period measurement task so that the count restarts from 0 during each bin interval.  Search the forums for topics related to photon counting and binning and you'll see some examples.  Here's one to get you started...

 

-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 4
(2,754 Views)

Thank you very much for your advice.

I found a forum post suggesting to use the example "Meas Dig Frequency-Buffered-Finite-High Freq 2 Ctr.vi" for counting using the second counter as a time reference.


I have modified it slightly to get the unit in ticks and not in frequency.

Do you think that it could work in my case ? (see attached diagram).

 

Best regards,

Michael

0 Kudos
Message 3 of 4
(2,740 Views)

Hi calvintiger,

 

That could work. This counter technique is essentially a way in which DAQmx uses two counters to measure a high frequency by having one counter control the gate of the other. This essentially means the first counter acts to arm the second counter. This general idea would be a good way of taking the measurements you want.

 

Essentially, you could have one counter output task that generates a pulse train. The pulse width of this pulse train would be equivalent to the amount of time in which you want to acquire the counter measurements. The output of this first counter would then input into the gate of the second counter. The second counter would then be configured as a counter input task that counts digital edges. This counter will only actually count edges during the finite, timed pulse generated by the first counter.

 

Here is an example that does a fairly good job outlining this idea. Note however that this example specifies that you will need external wiring. Depending on your hardware, you can probably internally route signals such that you will not need any external wires.

 

Also, the M Series User Manual has a really good section describing counters starting on page 7-2. Although you may not have an M series device, the explanations are still really good.

 

Hopefully this helps,

 

Chris G

Applications Engineer
National Instruments
0 Kudos
Message 4 of 4
(2,720 Views)