I have an application with USB-6501 where 12 DAQmx calls need to be made to do timings for the external hardware. I check with clock() function and it took about 100 ms to finish all these calls along with some calculations. Here is an example typical call that runs for about 8 ms in Interactive Window using CVI 8.0 in a new XP machine:
#include <utility.h>
#include <ansi_c.h>
#include <NIDAQmx.h>
static uInt8 w_data[1] = {1};
static unsigned long int x, x1, x2;
static double x3;
static TaskHandle taskHandle=0;
x = CLOCK_PER_SEC;
x1 = clock();
w_data[0] = 0;
DAQmxCreateTask("",&taskHandle);
DAQmxCreateDOChan(taskHandle,"Dev1/port2/line7","",DAQmx_Val_ChanForAllLines);
DAQmxStartTask(taskHandle);
DAQmxWriteDigitalLines(taskHandle,1,1,10.0,DAQmx_Val_GroupByChannel, w_data, NULL,NULL);
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
x2 = clock();
x3 = ((double)(x2-x1))/x;
printf ("x1 = %d\nx2 = %d\nElapsed time in sec = %f\n", x1, x2, x3);
------------------------------
Result:
x1 = 912272
x2 = 912280
Elapsed time in ms = 0.008000
----------------------------------------
My external circuit is supposed to take data at 20 ms interval for each data point. With 12 DAQ calls in the loop for each data point taking 100 ms, I am missing many data points. Is ther a way to get around this so 12 DAQ calls could be made shorter than 20 ms? Thanks for any suggestions!