08-10-2018 10:32 AM
I am using x series multifunction DAQ (NI 6368). I would like to do counter output with buffered sample clock timing. However, it keeps throwing this error:
----
DAQmx Error: Generation cannot be started, because the selected buffer size is too small. Increase the buffer size. Conflicting Property Property: DAQmx_Buf_Output_BufSize Corresponding Value: 0 Minimum Supported Value: 2 Channel Name: Dev1/ctr0 Task Name: _unnamedTask<0> Status Code: -200609
What could be wrong here?
----
I get this error either from my program, or even from the DAQmx C example code. For reference, here is the code in DAQmx example that throws the bufsize error:
"C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Counter\Generate Pulse\Dig Pulse Train-Cont-Buff-Ext Clk\DigPulseTrain-Cont-Buff-ExtClk.c"
#include <stdio.h>
#include <NIDAQmx.h>
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
int32 CVICALLBACK DoneCallback(TaskHandle taskHandle, int32 status, void *callbackData);
#define DUTY_MIN 0.50
#define DUTY_MAX 0.80
int main(void)
{
int error=0;
TaskHandle taskHandle=0;
int32 i;
float64 dataFreq[1000],dataDC[1000],dutyStep;
char errBuff[2048]={'\0'};
// Generating data for duty cycle from 0.50 to 0.80 in 1000 steps
dutyStep = (DUTY_MAX-DUTY_MIN)/1000;
for(i=0;i<1000;++i) {
dataFreq[i] = 1000.0;
dataDC[i] = DUTY_MIN + dutyStep*i;
}
/*********************************************/
// DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateCOPulseChanFreq(taskHandle,"Dev1/ctr0","",DAQmx_Val_Hz,DAQmx_Val_Low,0.0,1.00,0.50));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"/Dev1/PFI0",200,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000));
DAQmxErrChk (DAQmxWriteCtrFreq(taskHandle,1000,0,10.0,DAQmx_Val_GroupByChannel,dataFreq,dataDC,NULL,NULL));
DAQmxErrChk (DAQmxRegisterDoneEvent(taskHandle,0,DoneCallback,NULL));
/*********************************************/
// DAQmx Start Code
/*********************************************/
DAQmxErrChk (DAQmxStartTask(taskHandle));
printf("Generating pulse train. Press Enter to interrupt\n");
getchar();
Error:
if( DAQmxFailed(error) )
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( taskHandle!=0 ) {
/*********************************************/
// DAQmx Stop Code
/*********************************************/
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
}
if( DAQmxFailed(error) )
printf("DAQmx Error: %s\n",errBuff);
printf("End of program, press Enter key to quit\n");
getchar();
return 0;
}
int32 CVICALLBACK DoneCallback(TaskHandle taskHandle, int32 status, void *callbackData)
{
int32 error=0;
char errBuff[2048]={'\0'};
// Check to see if an error stopped the task.
DAQmxErrChk (status);
Error:
if( DAQmxFailed(error) ) {
DAQmxGetExtendedErrorInfo(errBuff,2048);
DAQmxClearTask(taskHandle);
printf("DAQmx Error: %s\n",errBuff);
}
return 0;
}
08-13-2018 05:53 PM
I Googled that error code and found this article:
Error -200609 When Using NI-DAQmx Output Tasks
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P7jnSAC
Down at the bottom it talks about the output buffer size which sounds like it applies to what you're seeing.