From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Control of two voltage channel by same triggering signal

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;

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

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?

0 Kudos
Message 2 of 2
(2,678 Views)