07-01-2019 03:55 PM
Can someone explain to me how the DAQmx edge counter handles the data being read. I don't understand the data capture process other than it is counting on the falling edge of a pulse. I have it set to take continuous data 100 samples at a rate of 1k. What exactly does this mean and what will the data be? I am trying to get this counter to give me a value and then reset every time and add the elapsed times per read so that I have an accurate counts per second.
07-01-2019 04:40 PM
Longer response below, but here's a brief summary first: a lot of the details will be handled for you if you use the counter in frequency measurement mode rather than edge counting mode. This includes handling both the reset and the time between reads in hardware to give you an accurate "counts/sec" result.
Counter measurements are often a different kind of animal than analog or digital data acq. It's frequently (pun intended) best to configure a counter task for "Implicit" timing rather than "Sample Clock" timing. This means that the signal itself serves to define the timing between samples, and can thus accommodate a variable sample rate.
You say you want an accurate measure of "counts per second." Typically, this would be done with a counter task configured to do frequency measurement. DAQmx Timing would be set for "Implicit". I generally like the simple "single counter" version that uses an fast internal timebase (up to 100 MHz) to measure the individual intervals between successive pulses.
With "Implicit" timing, you'd no longer think in terms of sample *at* 1 kHz. Your sample rate is defined by the pulses themselves, i.e., whatever rate the pulses arrive.
Some newer DAQ devices support constant-rate sampling of a variable frequency input. I haven't really explored it, but you should understand that any such approach must *necessarily* make some assumptions and compromises. You can read the device manual to learn more about the various ways to do frequency measurement.
-Kevin P