03-20-2007 11:18 AM
03-21-2007
12:02 PM
- last edited on
07-10-2026
02:04 PM
by
Content Cleaner
Hi Laurence,
Thank you for being decripting on your explanation. Let me paste the portion of the code I looked at:
.
.
.
DAQmxCfgSampClkTiming(taskHandle,"/Dev2/PFI0", 10000.0,DAQmx_Val_Falling,DAQmx_Val_ContSamps,2));
.
.
.
DAQmxRegisterEveryNSamplesEvent(taskHandle,DAQmx_Val_Acquired_Into_Buffer,2,0,ADEveryNCallback,NULL));
.
.
.
From the C reference help we see that the prototype is:
DAQmxCfgSampClkTiming (TaskHandle taskHandle, const char source[], float64 rate, int32 activeEdge, int32 sampleMode, uInt64 sampsPerChanToAcquire);
DAQmxRegisterEveryNSamplesEvent (TaskHandle taskHandle, int32 everyNsamplesEventType, uInt32 nSamples, uInt32 options, DAQmxEveryNSamplesEventCallbackPtr callbackFunction, void *callbackData);
When you configure the timing, there will be a buffer allocation done automatically (see Knowledge Base), in your case 1k. You can change this using Get/Set/Reset Buf_Input_BufSize.
The key problem in your case is the event you are registering. There is an event (IRQ) fired every 200ns (2/10k or depending on your external clock) which is probably too fast for OS software.
To solve this, I would suggest to acquire N samples where N is about 1/10 of your sample clock (or more). This will help the OS process every Event. Then in your callback you can handle the array to process more data while the card is acquiring the next batch.
Hope this helps,
03-22-2007 08:46 AM
03-22-2007 09:47 AM