hello friends
i am required slight help from ur side.
i am interfacing the USB6210 daq card through the visual c++ by using
the NIDAQmx 8.5 library
but its affecting the timing of program. program just taking the 750us
to just toggle the single digital line from high to low than to high
again. also i think its taking the more time to required samples.
plz help me, i am just attaching the my code
#include <iostream.h>
#include <conio.h>
#include <stdio.h>
#include "NIDAQmx.h"
int main(int argc, char *argv[])
{
int i=0,sample=0,j=0,cut=0,n=0,not=0,k=0;
int32 error=0;
TaskHandle taskHandle=0,taskHandled=0;
uInt8 low[1]={0};
uInt8 high[1]={1};;
int32 read;
float64 data[8000]={'\0'};
double time=0;
// double reading[125][5000]={'\0'};
char errBuff[2048]={'\0'};
Enter:
printf("Enter the averaging number:");
printf(":In between 0 and 10:");
//scanf("%d",n);
cin>>n;
if(n>10)
{
goto Enter;
}
else
{
// while(1)
{
for(i=0;i<10;i++)
{
sample=25+(100*i);
time=(sample*0.000004);
printf("samples %d\n",sample);
printf("time %f\n",time);
for(j=0;j<n-1;j++)
{
DAQmxCreateTask("analog",&taskHandle);
DAQmxCreateTask("digital",&taskHandled);
DAQmxCreateDOChan(taskHandled,"Dev2/port1/
line0","",DAQmx_Val_ChanForAllLines);
DAQmxCreateAIVoltageChan(taskHandle,"Dev2/
ai0","",DAQmx_Val_Cfg_Default,-5.0,5.0,DAQmx_Val_Volts,NULL);
DAQmxCfgSampClkTiming(taskHandle,"",
250000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,sample);
DAQmxStartTask(taskHandle);
DAQmxStartTask(taskHandled);
DAQmxWriteDigitalLines(taskHandled,
1,1,-1,DAQmx_Val_GroupByScanNumber,high,NULL,NULL);
DAQmxReadAnalogF64(taskHandle,sample,time,DAQmx_Val_GroupByChannel,data,sample,&read,NULL);
printf("\nread %d\n",read);
if(read == 0|| read==sample)
{
cut=cut+1;
}
// printf("cut %d",cut);
// double temp[10][7700];
for(k=0;k<sample;k++)
{
// temp[j][k]=data[k];
}
DAQmxWriteDigitalLines(taskHandled,
1,1,-1,DAQmx_Val_GroupByScanNumber,low,NULL,NULL);
DAQmxReadAnalogF64(taskHandle,sample,time,DAQmx_Val_GroupByChannel,data,sample,&read,NULL);
if(read == 0|| read==sample)
{
not=not+1;
}
// double fake[10][5000];
for(k=0;k<sample;k++)
{
// fake[j][k]=data[k];
}
DAQmxStopTask(taskHandle);
DAQmxClearTask(taskHandle);
DAQmxStopTask(taskHandled);
DAQmxClearTask(taskHandled);
}
}
}
}
getchar();
return 0;
}