Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Analog and Digital clock synchronization error (

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?

0 Kudos
Message 1 of 2
(1,749 Views)

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

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW?

(Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).



0 Kudos
Message 2 of 2
(1,730 Views)