Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

The buffer size definition in double buffer mode

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;

}

Message Edited by anarkie on 07-23-2009 09:51 AM
I'm converting DAQ to DAQmx..from Parkoz.com
0 Kudos
Message 1 of 2
(6,463 Views)
Please read the post by Neil S on this discussion forum and the post by Brian F on this forum.  I believe they may clear up your questions about how the DAQmx driver handles this vs Traditional DAQ.
Regards,


h_baker
National Instruments
Applications Engineer
0 Kudos
Message 2 of 2
(6,446 Views)