01-22-2008 12:41 AM
01-23-2008 10:37 AM
01-23-2008 12:05 PM
Dear Cris D,
Thank you for your reply. Based on some hints that I got from some other discssion forum and from you I have changed my code. The increase in sampling rate is from 47mSec to about 16mSec per set. But this is also too slow. I require below 10 mSec per set.
I must tell you that I started working on NiDAQmx only a few weeks ago.
I used the following code. Am I still making some mistake?
AItaskHandle=0;
DAQmxCfgSampClkTiming(AItaskHandle,NULL,10000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,1000);\\This makes no difference. DAQmxCreateTask("",&AItaskHandle);
DAQmxCreateAIVoltageChan(AItaskHandle,Dev3\ai0:1,"",DAQmx_Val_Diff ,-10.0,10.0,DAQmx_Val_Volts,NULL);\\only two channels
DAQmxStartTask(AItaskHandle);
while(Condition)
{
DAQmxReadAnalogF64(AItaskHandle,pointsToRead,timeout,DAQmx_Val_GroupByChannel,curdata,samplesPerChan,&pointsRead,NULL);
//Engg unit conversion, Grph plotting, writing to a textfile
}
if( AItaskHandle!=0 )
{
DAQmxStopTask(AItaskHandle);
DAQmxClearTask(AItaskHandle);
}Looking to see your reponse.
Alok Gupta
01-23-2008 01:23 PM
01-23-2008 10:59 PM
Dear Cris,
As per your suggestion I blocked the Taskhandle=0 statement, Secondly I have repostioned the timing function call after start task.
DAQmxCreateTask("",&AItaskHandle);
DAQmxCreateAIVoltageChan(AItaskHandle,chanAI,"",DAQmx_Val_Diff ,-10.0,10.0,DAQmx_Val_Volts,NULL);
DAQmxStartTask(AItaskHandle);
DAQmxCfgSampClkTiming(AItaskHandle,NULL,10000.0,DAQmx_Val_Rising,DAQmx_Val_FiniteSamps,10);
while(Condition)
{
DAQmxReadAnalogF64(AItaskHandle,pointsToRead,timeout,DAQmx_Val_GroupByChannel,curdata,samplesPerChan,&pointsRead,NULL);
}
I give below few lines of data as taken from my text file where I am writing each sample within the while loop
Cycle Time Force Disp Velocity
1 0.063 -101.14 -12.38 0.00
1 0.078 -94.10 -12.39 -0.22
1 0.094 -93.91 -12.39 -0.21
1 0.109 -95.86 -12.39 -0.22
Where is the mistake in my code?
01-24-2008 11:19 AM