05-04-2011 05:52 AM
Hi,
I had connected the NI USB-6009 to my PC and stared the VC++ code example project from
C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DAQmx ANSI C\Analog Out\Generate Voltage\Volt Update (see also code below)
It rise the error - "Device cannot be accessed" after DAQmxCreateAOVoltageChan function calling.
When the NI-USB-9162 is connected the code example project works perfect.
When I start the "Run Test Pannels" application with USB-6009, it works perfect too.
Could somebody please help me?
Thanks in advance.
Vladimir.
#include
<stdio.h>#include
<NIDAQmx.h>#define
int
{
TaskHandle taskHandle=0;
float64 data[1] = {1.0};
DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else main(void)int error=0;char errBuff[2048]={'\0'};/*********************************************/
// DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask(
DAQmxErrChk (DAQmxCreateAOVoltageChan(taskHandle,
"",&taskHandle));"Dev1/ao0","",-10.0,10.0,DAQmx_Val_Volts,""));/*********************************************/
// DAQmx Start Code
/*********************************************/
DAQmxErrChk (DAQmxStartTask(taskHandle));
/*********************************************/
// DAQmx Write Code
/*********************************************/
DAQmxErrChk (DAQmxWriteAnalogF64(taskHandle,1,1,10.0,DAQmx_Val_GroupByChannel,data,NULL,NULL));
Error:
DAQmxGetExtendedErrorInfo(errBuff,2048);
if( DAQmxFailed(error) )if( taskHandle!=0 ) {/*********************************************/
// DAQmx Stop Code
/*********************************************/
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
}
printf(
printf(
getchar();
}
if( DAQmxFailed(error) )"DAQmx Error: %s\n",errBuff);"End of program, press Enter key to quit\n");return 0;05-05-2011 09:50 AM
Hello Vladmuz,
If this is the exact code that you are running, then I suspect the issue arises from creating the AOVoltageChannel around "Dev1/ao0" device. How does your USB 6009 show up in MAX? It is probably Dev2, but you will want to check in Measurement & Automation Explorer.
05-08-2011 09:48 AM
Hi TJ Giere,
Thank you for help.
It just the reason.
Best regards.
Vladmuz.