Hi all,
I am trying to do edge counting with two counters simultaneously. The idea is to use them for photon counting application with two detectors. For this I use the third counter for synchronization. I configure it to generate single square pulse, and update the duration with my acquisition time for every measurement with DAQmxSetPulseHighTime function. The measurement counters are configured to use the rising edge of this pulse as arm start trigger (to start counting) and the low level of the pulse as pause trigger (to stop counting). And this works nicely.
However I noticed that Starting/Stopping tasks every time takes about 120 ms, so for acquisition time of, say, 100 ms this adds a considerable delay which I would like to avoid. I tried to keep the counting tasks running, but then the counter does not reset to zero, which obviously makes the results incorrect. I tried to reset the counters at the rising edge of the same pulse with DAQmxSetCICountEdgesCountReset but then it does not allow me to use the pause trigger, so that the counters do not stop counting when the pulse ends.
The only working solution that I was able to derive is to read the counter value before starting the trigger pulse, and then subtract this value from the counter value but this of course is nasty and I don't know what happens when the counter buffer overflows.
Is there a better way to achieve this goal?
The other thing is that in the future I would like to do the gated counting, meaning that there would be a hardware gate present when the laser pulse is present, so that the counting task would only run for a number of hardware gates (without resetting the count to 0) within a larger hardware gate that defines the acquisition time.
My board is NI USB-6366. The code is written in python but directly accesses DAQmx C functions so the question relates to ANSI C library.
Thanks,
Anton