08-05-2011 03:54 AM
Hello,
regarding ANSI C example "VC_ContAcq_IntClk" works great with one channel ai0.
If i do a measurement with 50 KHz for 2 seconds i get 100000 values.
Now i want to scan 4 channels each with 50 Khz and also for 2 seconds. But i also only get 100000 values (expected 400000) !
I increased Buffer from 1000 to 4000 and "DEV1/ai0" to "Dev1/ai0:3"
Is the sampling rate for all channels or only for one ?
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle, "", 50000.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000));
If i increase sampling rate to 200 Khz i get the error 200019
Code :
DAQmxErrChk (DAQmxCreateTask("", &taskHandle));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0:3", "", DAQmx_Val_RSE, -10.0, 10.0, DAQmx_Val_Volts, NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"", 50000.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000));
DAQmxErrChk (DAQmxRegisterEveryNSamplesEvent(taskHandle,DAQmx_Val_Acquired_Into_Buffer,1000,0,EveryNCallback,NULL));
DAQmxErrChk (DAQmxRegisterDoneEvent(taskHandle,0,DoneCallback,NULL));
...
DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByScanNumber,data,4000,&read,NULL));
I need a sloution in C to scan at least 4 channels with each at 50 KHz !
Thanks in Advance
08-08-2011 07:27 AM
Hi LabJoe,
your NI PCI-6024 meets the sampling rate requirements for you data acquisition (200 kS/s).
DAQmxCfgSampClkTiming's parameter rate represents the sampling rate in samples per second per channel.
Please try to adjust the DAQmxCfgSampClkTiming's parameter called sampsPerChanToAcquire from value 1000 to 50000. If you are using sample mode DAQmx_Val_ContSamps, then this value determines the buffer size. You can see, in attached (sample rate/buffer size) table, that sampsPerChanToAcquire value allocates buffer of size 10kS, which is not sufficient in case that you acquire 100kS/s with your data acquisition settings.
Sample Rate | Buffer Size |
---|---|
No rate specified | 10 kS |
0–100 S/s | 1 kS |
100–10,000 S/s | 10 kS |
10,000–1,000,000 S/s | 100 kS |
>1,000,000 S/s | 1 MS |
Kind regards
Marek Santavy