LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

edge counting with USB-6229, sampsPerChanRead=0 at first iteration

Hi everyone!

I am using a USB-6229 M-series DAQ card for photon counting.

Counter 0 is used to produce a train of pulses at 40 Hz, which is the gate of counter 1. The source of counter 1 is the signal coming from a photodetector. In other words, I have implemented a code for buffered edge counting with an external clock in continuous sample mode. Both counters begin to work at the same time, once they have received the same trigger, a digital output (I used the Start Trigger for counter 0 and the Arm Start Trigger for counter 1). Then, counter 1 will list the counts read every 25 ms. The function that actually reads the samples is

int32 DAQmxReadCounterU32 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, uInt32 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

where sampsPerChanRead is the actual number of samples read from each channel.

Everything works fine, but I cannot understand why the first iteration of the loop always gives sampsPerChanRead = 0, as it can be inferred running the code in debugging configuration. Only the second time that DAQmxReadCounterU32 has been run, sampsPerChanRead is different from zero. Why during the first iteration no sample is read? Which could be the cause? Could the counter arm play a role?

Thank you for your help.

Regards,

Giulia

0 Kudos
Message 1 of 1
(2,395 Views)