Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Using 6254 how to read voltage based on external clock

Hi all,

 

I would like to know how to read the entire 32 line AI channels in 6254 card base on an external clock. In PFI2 & PFI4 lines a clock from 1 kHz to 100 kHz is passing. On each rising edge of the clock I should read the voltage.

I tried to implement this function with the help of event callback function, but when I added count on the call back I found it not triggering for all the events.

The code:

TaskHandle taskHandle;

iStatus=DAQmxCreateTask(_T("RunUptask"),&taskHandle);

iStatus=DAQmxCreateAIVoltageChan(taskHandle,_T("Dev5/ai0:31"),_T("ai0:31"),DAQmx_Val_NRSE,0,10,DAQmx_Val_Volts,NULL);

iStatus=DAQmxCfgSampClkTiming(taskHandle,_T("PFI2,PFI4"),100,DAQmx_Val_Rising,DAQmx_Val_ContSamps,100);

iStatus=DAQmxRegisterSignalEvent(taskHandle,DAQmx_Val_SampleClock,0,RunUpCallback,this);

iStatus=DAQmxStartTask(taskHandle);

For reading the voltage I am using:

DAQmxReadAnalogF64(taskHandle,DAQmx_Val_Auto,DAQmx_Val_WaitInfinitely, DAQmx_Val_GroupByChannel,RunupReading, 32, &sampsPerChanRead, NULL);

 

If any body has any idea how to solve this, please share with me.

 

Thanks & regards

Renjith.

0 Kudos
Message 1 of 1
(2,725 Views)