09-07-2011 12:52 PM
I am having a problem with buffered edge counting with an external sample clock, with a USB 6120 DAQ. The problem is that the number of counts in one second changes when the frequency of the sample clock is changed.
I am trying to count pulses from an APD (avalanche photodiode), the output of which I plugged into pin PFI0, which I believe is counter 0. The external clock is a function generator making square pulses with amplitude 10 V and duty cycle of about 1/2. I checked this with an oscilloscope and it is functioning properly. The external clock I have tried plugging into pins PFI1-PFI3, and choosing the appropriate pin as the sample clock in the software.
I have done this with both labview and the NI "Measurement and Automation Explorer" program, and have gotten the same result with each. The number of counts in one second is about 1700 for 1 kHz sample clock, 10,000 for 10 kHz sample clock, and 20,000 for 100 kHz sample clock. I know the counts/second for the APD should be about 6,000 because of an alternative measurement method. If I use the 100 kHz timebase as the sample clock I get the correct 6,000 counts in one second, but I need to be able to change the sampling rate, so I still need to use the external clock.
I would think I got it backward and was actually counting the sample clock, except I know the DAQ is counting from the APD because when I turn on a flashlight the number of counts increases significantly.
I would greatly appreciate any thoughts on the matter. Thanks!
09-07-2011 04:39 PM
Hi Igor,
I'm not sure I follow the logic of the external sample clock. Why sample at 100 kHz if the external signal is only ~6 kHz? You'd expect to get several consecutive samples of identical information. Also, there are 2 counters on the 6210 so perhaps you could use the 2nd one to generate the sample clock if you needed to so then you could avoid having to use the external function generator.
Do you have code that shows what you are trying to do? If you are interested in the number of counts per second, why not sample once every second?
Best Regards,
09-07-2011 05:27 PM
Thanks for answering. My application is FCS (fluorescence correlation spectroscopy), and so I am trying to use the APD/DAQ to measure the light intensity (count photons) with high temporal resolution. So getting several consecutive samples with no new counts is actually fine with me (unless you mean that it is double counting, in which case that's not fine, lol).
I'm not really interested in the number of counts in one second, it was just a handy unit of comparison. The problem I'm having is that I don't know why the DAQ is reading different count rates from the APD for different sampling rates. It seems to me that it should be the same, in which case something is wrong.
I suppose I could use the second counter to generate a sample clock, but I don't really understand the difference between using a square wave generated by the DAQ, and a square wave generated by a function generator. (Also I was planning to use the second counter for a second APD.)
I am going to try to attach the labview file, "buffered sampling.vi"
09-08-2011 10:24 AM
How are you computing the count rate? The example program returns an array of counts--are you then subtracting consecutive elements and multiplying by the sample rate (if you want units of counts per second)? This method would have a high degree of error if your sample clock is fast relative to the frequency of the input signal--the resolution of each sample would be 1 tick of the 6 kHz signal from the APD.
Your temporal resolution is going to be limited by the frequency of the output of the APD--the maximum amount of new rates you could calculate would be once per every period of the signal from the APD. So, you might want to consider configuring the counter to make a buffered frequency measurement, which would count the duration of each period of the APD signal (using the internal timebase) and invert to obtain frequency. Of course, in doing this you would no longer have control over the sample rate, but I'm still not clear why you need this control in the first place. See here for an example of a buffered period measurement (buffered frequency is almost exactly the same, but the driver inverts the values for you).
Best Regards,
09-08-2011 04:32 PM
This is really silly, but I'm pretty sure I fixed my problem by unplugging the DAQ card and plugging it in again.
Thanks for the help. And thanks for suggesting that I might use the counter for period measurement... the time between pulses is really what I want to measure. I'll look into that.