10-06-2017 09:39 AM
I'm currently working on a project where my digital and analog outputs must be done simultaneously. I wanted to setup a basic test file in C but I keep getting an error message, namely code -200077.
DAQmx Error: Requested value is not a supported value for this property. The property value may be invalid because it conflicts with another property.
Property: DAQmx_SampTimingType
Requested Value: DAQmx_Val_SampClk
Possible Values: DAQmx_Val_OnDemand
The code I have thusfar:
#include <NIDAQmx.h>
#include <stdio.h>
#include <math.h>
void errorCheck(int func)
{
	if (!DAQmxFailed(func)) return;
	char errBuff[2048] = { '\0' };
	DAQmxGetExtendedErrorInfo(errBuff, 2048);
	printf("DAQmx Error: %s\n", errBuff);
}
int main(void) 
{
	float64 dataAO[1000] = { 0 };
	float64 dataDO[1000] = { 0 };
	// Analog
	TaskHandle taskhandleAO = 0;
	errorCheck(DAQmxCreateTask("Analog", &taskhandleAO));
	errorCheck(DAQmxCreateAOVoltageChan(taskhandleAO, "Dev1/ao0", "", -10, 10, DAQmx_Val_Volts, ""));
	//errorCheck(DAQmxSetWriteRegenMode(taskhandleAO, DAQmx_Val_DoNotAllowRegen));
	errorCheck(DAQmxCfgSampClkTiming(taskhandleAO, "", 100.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000));
	// Digital
	TaskHandle taskhandleDO = 0;
	errorCheck(DAQmxCreateTask("Digital", &taskhandleDO));
	errorCheck(DAQmxCreateDOChan(taskhandleDO, "Dev1/port0/line0", "", DAQmx_Val_ChanPerLine));
	//errorCheck(DAQmxSetWriteRegenMode(taskhandleDO, DAQmx_Val_DoNotAllowRegen));
	errorCheck(DAQmxCfgSampClkTiming(taskhandleDO, "ao/SampleClock", 100.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000));
	errorCheck(DAQmxWriteAnalogF64(taskhandleAO, 1000, 1, 10.0, DAQmx_Val_GroupByChannel, dataAO, NULL, NULL));
	errorCheck(DAQmxWriteDigitalLines(taskhandleDO, 1000, 0, 10.0, DAQmx_Val_GroupByChannel, dataDO, NULL, NULL));
	errorCheck(DAQmxStartTask(taskhandleDO));
	errorCheck(DAQmxStartTask(taskhandleAO));
}
What am I doing wrong?
10-06-2017 10:50 AM
Based on the error text, it sure sounds like you have data acq hardware that doesn't support hardware-timed tasks for AO, DO, or both. DO tends to be the more common culprit. What data acq board/hardware are you using?
-Kevin P