Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Data Aquisition Error

HI, Everybody:
      I am using PCI-6602 counter/timer to get the photon arrival time. But the data I got looks a little strange.
      My system can be briefly described as this:
     Photons--> Photon Detector--> Counter/Timer Gate.
     The labview code I use is based on the example code ---- Meas Dig Periods-buffered-continuous-High-freq 2 Ctr. But I changed the measuring method of the virtual channel to high frequency with *1* counter, so that I can get each and every interval between those photons.
     Unfortunately, the code only runs for about 1 second before it crashes (sometimes shorter, like 0.1s, sometimes as long as 3 seconds).  Most of the data looks fine, but every now and then there will be a high spike of data, like the figure I attached here. The error message is 200141, telling me the data is overwritten.  I am a little confused, because I clear the task immediately after taking the data, so the buffer should be cleared at the same time, right? And the photon intensity is less than 20KHz, so the counter should be able to handle it, right?
     I am not very familiar with DMA(sorry:(), so although I tried to use it, it seems to make things worse. The code crashes after several miliseconds! I attached my code here, with and without DMA, and I really appreciate it if you can help finding out what's wrong with my code or method.
    Thanks!
xiaoman
Download All
0 Kudos
Message 1 of 2
(3,396 Views)
Looking at your code, the DMA setting shouldn't make a difference to you.  DAQmx chooses DMA for data transfer by default so both of your code examples should do the same thing.
 
I would guess that one of two things is causing your problem:
 
1.  The file I/O in the while loop with the read might be taking long enough that the counter doesn't get read often enough.  Moving the writes outside of the while loop and writing all of your data at once at a later point might be useful.
2.  Noise or other variations in your input signal.  the 6602 only has a two element FIFO for data transfer, so if your input signal has a small high frequency glitch, that might be enough to overflow the counter.  This is likely your problem.  I would suggest one of two things: either use the 2 counter high frequency measurement (which averages the frequency over a specified amount of time) or try using the TIO's digital filters to clean up your input signal.
 
I hope this helps!
gus....
0 Kudos
Message 2 of 2
(3,380 Views)