hello, all
I want AI to start acquiring data when the data is bigger than n(n is a value we defined).
I use simulated NI-USB 6251 to test.
I have searched the NI-DAQmx C Reference Help and find the function DAQmxCfgAnlgEdgeStartTrig.
My code is listed:
int AIsampleRate = 100;
double n = 4.0;
DAQmxErrChk (DAQmxCreateTask("",&AItaskHandle));
DAQmxErrChk (DAQmxCreateAIVoltageChan(AItaskHandle,"Dev17/ai0","",DAQmx_Val_RSE,-10.0,10.0,DAQmx_Val_Volts,NULL));
DAQmxErrChk (DAQmxCfgSampClkTiming(AItaskHandle,"",AIsampleRate,DAQmx_Val_Rising,DAQmx_Val_ContSamps,AIsampleRate));
DAQmxErrChk (DAQmxCfgAnlgEdgeStartTrig(AItaskHandle,"Dev17/ai0",DAQmx_Val_RisingSlope, n));//if the data bigger than n,AI start
DAQmxErrChk (DAQmxSetAnlgEdgeStartTrigHyst(AItaskHandle, 1.0));
DAQmxErrChk (DAQmxStartTask(AItaskHandle));
DAQmxErrChk (DAQmxReadAnalogF64(AItaskHandle,100,10.0,DAQmx_Val_GroupByScanNumber,data,100,&read,NULL));
there is no error on my code.
and if I do not use DAQmxCfgAnlgEdgeStartTrig, the data AI acquired is like figure 1.
figure 1
and if I use DAQmxCfgAnlgEdgeStartTrig, the data AI acquired will like figure 2 (frome 4.0).
figure 2
but, now the two results are the same, they are all like the figure1.
So how can I achievethe purpose I wanted?