Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

analog input on digital external trigger

Hi,
I am using  a NIDAQmx labcard and somehow I can still not figure out how to do the following:
 
Have a digital external trigger (I was thinking of DAQmxCfgDigEdgeStartTrig(handle, "Dev1/port0/line0", DAQmx_Val_Rising)) and read an analog input and do some other stuff. This should be a fast application, working at 5kHz. I would like to know which functions to use for this. I need the data from only two channels and one datapoint per trigger.
 
What I have and does not work is:
DAQmxCreateTask("AnalogIn", &m_hai)
DAQmxCreateAIVoltageChan(m_hai, "Dev1/ai0", NULL, DAQmx_Val_Cfg_Default, 0, 10.0, DAQmx_Val_Volts, NULL)
DAQmxCreateAIVoltageChan(m_hai, "Dev1/ai1", NULL, DAQmx_Val_Cfg_Default, 0, 10.0, DAQmx_Val_Volts, NULL)
DAQmxCfgSampClkTiming(m_hai, "", 5000, DAQmx_Val_Rising, DAQmx_Val_HWTimedSinglePoint , 1)
DAQmxCfgDigEdgeStartTrig(m_hai, "Dev1/port0/line0" ,DAQmx_Val_Rising)
DAQmxStartTask(m_hai)
 
for(int i=0;i<1000;i++)
 {
        DAQmxReadAnalogF64(m_hai, 1, 10.0, DAQmx_Val_GroupByScanNumber, array, 3, &read, NULL)
        /* Here is some extra stuff*/ 
}
m_ni6221.StopTask(m_ni6221.m_hai);
 
I hope that anyone could help me on short notice, with best regards,
Arno
 
0 Kudos
Message 1 of 1
(2,938 Views)