11-09-2022 06:45 AM
I am trying to implement analogue acquisition software to interface with a USB 6211 device.
I have this working but on some PC's this fails.
To help simplify investigation, I use one of the provided examples "Internal analogue trigger" and the failure is consistent with my own application.
The test program I run is shown below.
#include <stdio.h>
#include <NIDAQmx.h>
#define DAQmxErrChk(functionCall) if( DAQmxFailed(error=(functionCall)) ) goto Error; else
int main(void)
{
int32 error=0;
TaskHandle taskHandle=0;
int32 read;
float64 data[1000];
char errBuff[2048]={'\0'};
/*********************************************/
// DAQmx Configure Code
/*********************************************/
DAQmxErrChk (DAQmxCreateTask("",&taskHandle));
DAQmxErrChk (DAQmxCreateAIVoltageChan(taskHandle,"Dev1/ai0","",DAQmx_Val_Cfg_Default,-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(taskHandle,"",10000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000));
/*********************************************/
// DAQmx Start Code
/*********************************************/
DAQmxErrChk (DAQmxStartTask(taskHandle));
/*********************************************/
// DAQmx Read Code
/*********************************************/
DAQmxErrChk (DAQmxReadAnalogF64(taskHandle,1000,10.0,DAQmx_Val_GroupByChannel,data,1000,&read,NULL));
printf("Acquired %d points\n",(int)read);
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;
}
And the error reported is as follows :
DAQmx Error: Some or all of the samples requested have not yet been acquired.
To wait for the samples to become available use a longer read timeout or read later in your program. To make the samples available sooner, increase the sample rate. If your task uses a start trigger, make sure that your start trigger is configured correctly. It is also possible that you configured the task for external timing, and no clock was supplied. If this is the case, supply an external clock.
Property: DAQmx_Read_RelativeTo
Corresponding Value: DAQmx_Val_CurrReadPos
Property: DAQmx_Read_Offset
Corresponding Value: 0
Task Name: _unnamedTask<0>
Status Code: -200284
End of program, press Enter key to quit
When I use NI MAX to perform a test, this works well, so this provides confidence that the drivers are installed correctly.
I am running Windows 10 and have installed Ni-DAQmx 2022 Q3.
The USB-6211 driver is nixsirkw.sys 22.50f96.
I would be grateful for some with this.
11-09-2022 04:12 PM
Do the DAQmx test panels work without error?
11-10-2022 04:14 AM
Thanks for your prompt response.
Yes the test panels work, for both Dev1 and Dev2 without error.
I have discovered now that my test program works (on the failing PC) when I select Dev2/ai0 but not Dev1/ai0, whereas on other PCs, the test program works using both Dev1 and Dev2.
11-10-2022 05:56 AM
I tried renaming Dev1 to Dev2 and Dev2 to Dev1 and both now work, even when I reverted the names back. So it appears that there was something wrong with the device ID for Dev1 and this needed to be re-applied. Perhaps this issue is caused by there being two devices appearing on the same USB connection.