Hi Mami.
The only other USB devices I have are mouse and a keyboard.
Looks like it takes about 30 seconds for DAQ library funcrion call : DAQmxErrChk (DAQmxBaseCreateTask("port29",&taskHandle));
what kind of errors you are getting?
This is the recent test code:
It looks like once board is ready it works without delay...
Thanks a lot,
andrei
//************************cut below this line ***********
*
* ANSI C Example program:
* melter.c
*
* Example Category:
* CI
*
*********************************************************************/
#include "NIDAQmxBase.h"
#include
#include
#define DAQmxErrChk(functionCall) { if( DAQmxFailed(error=(functionCall)) ) { goto Error; } }
static int gRunning;
int main(int argc, char *argv[])
{
// Task parameters
int32 error = 0;
TaskHandle taskHandle = 0;
char errBuff[2048]={'\0'};
time_t startTime;
// Channel parameters
char chan[] = "Dev1/ctr0";
char name[20];
// Data read parameters
uInt32 data=0;
uInt32 startCounterValue = 0;
float64 timeout = 0.0;
printf("Initializing DAQ board\n");
DAQmxErrChk (DAQmxBaseCreateTask("port29",&taskHandle));
printf("Board is ready, Type S (start) and press enter key\n");
scanf("%s",&name);
DAQmxErrChk (DAQmxBaseCreateCICountEdgesChan(taskHandle,chan,"",DAQmx_Val_Falling,startCounterValue,DAQmx_Val_CountUp));
printf("READY2\n");
DAQmxErrChk (DAQmxBaseStartTask(taskHandle));
gRunning = 1;
// The loop will quit after 5 seconds
//C function gets time
startTime = time(NULL);
int counter1 = 1;
printf("READY\n");
while(counter1 <= 100) {
DAQmxErrChk (DAQmxBaseReadCounterScalarU32(taskHandle,timeout,&data,NULL));
printf("Iteration: %d\n",counter1);
printf("Count: %d\n",data);
//printf("Time: %d\n",time());
counter1++;
}
printf("Will run test for 10 seconds\n");
// The loop will quit after 10 seconds
startTime = time(NULL);
while( gRunning && time(NULL) DAQmxErrChk (DAQmxBaseReadCounterScalarU32(taskHandle,timeout,&data,NULL));
printf("\rCount: %d",data);
}
counter1 = 1;
while(counter1 <= 100) {
DAQmxErrChk (DAQmxBaseReadCounterScalarU32(taskHandle,timeout,&data,NULL));
printf("Iteration: %d\n",counter1);
printf("Count: %d\n",data);
//printf("Time: %d\n",time());
counter1++;
}
//*DAQmxErrChk (DAQmxBaseClearTask(taskHandle));*/
Error:
puts("");
if( DAQmxFailed(error) )
DAQmxBaseGetExtendedErrorInfo(errBuff,2048);
if( taskHandle!=0 ) {
DAQmxBaseStopTask(taskHandle);
DAQmxBaseClearTask(taskHandle);
}
if( DAQmxFailed(error) )
printf("DAQmxBase Error: %s\n",errBuff);
return 0;
}