03-25-2009 02:21 AM
HI
Based on the clock which is given in channel PFI2 & PFI 4 I want to read the voltage from 6254 on channels ai0:31 through the Callback function.
I did the code which is given below to achieve this requirement.
DAQmxCreateTask(_T("RunUptask"),&taskHandle);
DAQmxCreateAIVoltageChan(taskHandle,_T("Dev5/ai0:31"),_T("ai0:31"),DAQmx_Val_NRSE,0,10,DAQmx_Val_Volts,NULL);
DAQmxCfgSampClkTiming(taskHandle,_T("PFI2,PFI4"),100,DAQmx_Val_Rising,DAQmx_Val_ContSamps,100);
DAQmxRegisterSignalEvent(taskHandle,DAQmx_Val_SampleClock,0,RunUpCallback,this);
DAQmxStartTask(taskHandle);
Is these steps are enough to achieve my requirement? or any more configuration required.
Thanks,
Renjith
07-27-2009 05:22 AM
Hi,
This problem resoved,
DAQmxCreateTask(_T("MyTask"),&taskHandle);
DAQmxCreateAIVoltageChan(taskHandle,sChannels,NULL,DAQmx_Val_NRSE,0,10,DAQmx_Val_Volts,NULL);
DAQmxCfgDigEdgeStartTrig(taskHandle,"PFI2",DAQmx_Val_Rising );
DAQmxCfgSampClkTiming(taskHandle,"PFI2",ClockSpeed,DAQmx_Val_Falling,DAQmx_Val_FiniteSamps,m_nSamples);
DAQmxStartTask(taskHandle);
and with read function
DAQmxReadAnalogF64(taskHandle,-1,100, DAQmx_Val_GroupByChannel,read,m_nSamples*m_nNoofChannels,&sampsPerChanRead, NULL);
This will read all the samples available in buffer.