Digital I/O

cancel
Showing results for 
Search instead for 
Did you mean: 

Sample of DAQmxCreateDOChan have error (NI-USB-6211)

Hello,

 

I ran the sample program

C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Digital\Generate Values\Cont Write Dig Port-Ext Clk, but got a message as below:

 

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

Task Name: _unnamedTask<0>

Status Code: -200077
End of program, press Enter key to quit

 

 

 

I'm using USB-6211 and nothing is connected to it except usb cable.

Could you give any advice regarding this error?

 

Main program is here:

int main()
{
	int32       error = 0;
	TaskHandle  taskHandle = 0;
	uInt32      data[8] = { 1,2,4,8,16,32,64,128 };
	char        errBuff[2048] = { '\0' };

	/*********************************************/
	// DAQmx Configure Code
	/*********************************************/
	DAQmxErrChk(DAQmxCreateTask("", &taskHandle));
	DAQmxErrChk(DAQmxCreateDOChan(taskHandle, "Dev2/port1", "", DAQmx_Val_ChanForAllLines));
	DAQmxErrChk(DAQmxCfgSampClkTiming(taskHandle, "/Dev2/PFI0", 1000.0, DAQmx_Val_Rising, DAQmx_Val_ContSamps, 1000));

	DAQmxErrChk(DAQmxRegisterDoneEvent(taskHandle, 0, DoneCallback, NULL));

	/*********************************************/
	// DAQmx Write Code
	/*********************************************/
	DAQmxErrChk(DAQmxWriteDigitalU32(taskHandle, 8, 0, 10.0, DAQmx_Val_GroupByChannel, data, NULL, NULL));

	/*********************************************/
	// DAQmx Start Code
	/*********************************************/
	DAQmxErrChk(DAQmxStartTask(taskHandle));

	printf("Generating digital output continuously. 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;
}

 

Thank you.

0 Kudos
Message 1 of 4
(2,426 Views)

Typically on M-series boards (and perhaps universally?), hardware-timed DIO is only supported on port 0.

 

I'm a LabVIEW-only guy, but it appears that you are correctly configuring to use an external signal as a sample clock on PFI0 (because M-series DIO tasks *also* do not support the ability to derive their own sample clock timing).  Maybe all you need to do is change the config (and physical wiring) to use port 0 instead of port 1.

 

 

-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 4
(2,409 Views)

Dear Kevin,

Thank you for your reply.

 

I reviewed the device settings as you taught me.
Looking at the error, apparently my device does not correspond to the sample clock  regardless of the ports.
Thank you for helping me with my problem.

0 Kudos
Message 3 of 4
(2,402 Views)

Just to clarify:

 

Port 0 can *use* a sample clock, but it can't make one for itself.  Your task appears to want to use pin PFI0 as a sample clock.  If you put a clock signal on that pin somehow, you should be able to get your task to work.

 

 

-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 4 of 4
(2,395 Views)