We are trying to use the USB-6211 to generate a analog output from a data buffer. The data is to be output at 8KHz. At the same time an Analog input task in reading data at the same rate. The input task seems to work but there is an error message when attempting to set the data rate for the output. The code setting up the task is:
DAQmxErrChk (DAQmxCreateTask("",&DAStaskHandle));
sprintf_s(devcmd,sizeof(devcmd),"%s/ao1",NI_device);
DAQmxErrChk (DAQmxCreateAOVoltageChan(DAStaskHandle,
devcmd, //physical channel
"", //name assigned
-1.0, //min output value
1.0, //max output value
DAQmx_Val_Volts, //units of output
"" //custom scale name
));
DAQmxErrChk (DAQmxCfgSampClkTiming(DAStaskHandle,
"", //source (default to OnboardClock)
SAMPLE_FREQUENCY, //rate in samples per second
DAQmx_Val_Rising, //active edge
DAQmx_Val_ContSamps, //Continuous sampling
ADSampleSize //samples to aquire
));
/*********************************************/
// DAQmx Start Code
/*********************************************/
DAQmxErrChk (DAQmxStartTask(DAStaskHandle));
where the macro DAQmxErrChk is an error check causing a program abort and error message display.
and the error message is:
Non-buffered hardware-timed operations are not supported for this device and Channel Type.
Set the Buffer Size to greater than 0, do not configure Sample Clock timing, or set Sample Timing Type to On Demand.
Task Name: _unnamedTask<3>
Status Code: -201025
If this is not the correct command or the device is not programed this way, How does one send a buffer of on the order of 100000 samples to the D-A at a 8 KHz rate? Is the device limited to only input or output but not both? As the device claims to output at up to 250KHz and buffer upto 8191 samples, it would appear that it has some form of internal clocking to output the samples.
The message says "Set Buffer Size to greater than 0" but there does not seem to be anyplace to do this other than the last argument in DAQmxCfgSampClkTiming and I have tried values from 1000 to 32000 there with the same result.