07-23-2009 09:43 AM - edited 07-23-2009 09:51 AM
Hello?
I have a question about the buffer size in double buffer mode.
We have 4 different sample mode selected by user. 400, 800, 1200, and 1600 data points are required whenever user chooses one of them as sample number. And the total sample number will be multiplied by channel number 6.
But we will display only single buffer while acquiring next buffer.
Here is data buffer definition. DataBuffer_2400~9600 is the buffer with the maximum size of sample per each selection.
short DataBuffer_2400[2400];
short DataBuffer_4800[4800];
short DataBuffer_7200[7200];
short DataBuffer_9600[9600];
int ClBufferSize, iSelect, j, iTarget;
unsigned long HalfSize;
if( ptr->fdat.trace_size == TRACESIZE_400 ){ //400 points
ClBufferSize = 400 * 6;
iSelect = 400;
}
HalfSize = (unsigned long)ClBufferSize;
And here are DAQmx codes. I wonder how to choose buffer size of DAQmxCfgSampClkTiming and DAQmxReadBinaryI16. Is single buffer size a half of it?
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",Cptr.m_fSrate_Public,DAQmx_Val_Rising,DAQmx_Val_ContSamps,ClBufferSize*2));
...
DAQmxErrChk (DAQmxSetAIDataXferReqCond(taskHandle, "Dev1/ai0:5", DAQmx_Val_OnBrdMemMoreThanHalfFull));
DAQmxErrChk (DAQmxSetReadOverWrite(taskHandle, DAQmx_Val_DoNotOverwriteUnreadSamps));
...
if(iSelect == 400)
DAQmxErrChk (DAQmxReadBinaryI16(taskHandle,-1,1.0,DAQmx_Val_GroupByScanNumber,DataBuffer_2400,2400,&read,NULL));
...
if(iSelect == 400){
for(j = 0; j < iTarget; j++){
ptr->EvenBank[j]=DataBuffer_2400[j];
ptr->OddBank[j]=NULL;
}
}
07-24-2009 05:26 PM