04-13-2017 12:56 PM
Hello, I'm trying to control two galvo-mirrors by DAQmx.
I wanted to use same triggering signal for both of mirrors, so I did the below tasks for both of mirrors.
Create task->Create voltage channels->Receive clk signal from external source->
Create internal triggering->Write voltage to mirror->start task
The code is as below, but there is an error when DAQmxWriteAnalogF64 function is run sequentially.
Is there anything wrong? Thank you 🙂
int hr;
if((hr = DAQmxCreateTask("",&_hMirrorB)) < 0)
return hr;
if((hr = DAQmxCreateTask("",&_hMirrorC)) < 0)
return hr;
if((hr = DAQmxCreateAOVoltageChan(_hMirrorB, DAQ_AO0,"", _cfg.bscanMin,
_cfg.bscanMax, DAQmx_Val_Volts, "")) < 0)
return hr;
if((hr = DAQmxCreateAOVoltageChan(_hMirrorC, DAQ_AO0,"", _cfg.cscanMin,
_cfg.cscanMax, DAQmx_Val_Volts, "")) < 0)
return hr;
if((hr = DAQmxCfgSampClkTiming(_hMirrorB, DAQ_EXT, EXT_CLK,
DAQmx_Val_Falling, DAQmx_Val_ContSamps, _cfg.N0)) < 0)
return hr;
if((hr = DAQmxCfgSampClkTiming(_hMirrorC, DAQ_EXT, EXT_CLK,
DAQmx_Val_Falling, DAQmx_Val_ContSamps, _cfg.N0)) < 0)
return hr;
if((hr = DAQmxCfgDigEdgeStartTrig(_hMirrorB, DAQ_INT, DAQmx_Val_Rising)) < 0)
return hr;
if((hr = DAQmxCfgDigEdgeStartTrig(_hMirrorC, DAQ_INT, DAQmx_Val_Rising)) < 0)
return hr;
if((hr = DAQmxWriteAnalogF64(_hMirrorB, _cfg.N0, 0, 10.0,
DAQmx_Val_GroupByChannel, (float64*)_bscanWaveform, NULL, NULL)) < 0) {
return hr;
}
if((hr = DAQmxWriteAnalogF64(_hMirrorC, _cfg.N0, 0, 10.0,
DAQmx_Val_GroupByChannel, (float64*)_bscanWaveform, NULL, NULL)) < 0) {
return hr;
}
if((hr = DAQmxStartTask(_hMirrorB)) < 0)
return hr;
if((hr = DAQmxStartTask(_hMirrorC)) < 0)
return hr;
04-14-2017 06:29 PM
1. Could you please clarify what are you trying to do with this program?
2. Where it looks like you want to check for errors, there is some Help documentation on this specific to LabWindows/CVI (http://zone.ni.com/reference/en-XX/help/370051AC-01/cvi/programmerref/checkingforerrors/)
3. Are you seeing a specific error message or code when the DAQmxWriteAnalogF64 function is sequentially running?