Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How to synchronize two analog output with USB-6353 sharing a trigger

I'm have the need to synchronize two analog output on the same device (USB 6353) sharing a trigger signal on PFI0.

 

The programming environement is Visual C++ , and the code I wrote is as following:

 

DAQmxCreateTask ("", &Ao0TaskHandle);  // is the task handle for the analog output Ao0

DAQmxCreateVoltageChan((Ao0taskHandle,"Dev1/Ao0","",-5.0,5.0,DAQmx_Val_Volts,NULL);

DAQmxCfgSampClkTiming(Ao0taskHandle,5000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000);

DAQmxCfgDigEdgeStartTrig(Ao0taskHandle,"/Dev1/PFI0",DAQmx_Val_Rising);

 

DAQmxCreateTask ("", &Ao1TaskHandle);  // is the task handle for the analog output Ao1

DAQmxCreateVoltageChan((Ao1taskHandle,"Dev1/Ao1","",-5.0,5.0,DAQmx_Val_Volts,NULL);

DAQmxCfgSampClkTiming(Ao1taskHandle,5000.0,DAQmx_Val_Rising,DAQmx_Val_ContSamps,1000);

DAQmxCfgDigEdgeStartTrig(Ao1taskHandle,"/Dev1/PFI0",DAQmx_Val_Rising);

 

 

DAQmxWriteAnalgF64(Ao0taskHandle,1000,FALSE,10.0,DAQmx_Val_GroupByChannel,AOdata,NULL,NULL);  AOdata is a buffer containing a sinwave

DAQmxWriteAnalgF64(Ao1taskHandle,1000,FALSE,10.0,DAQmx_Val_GroupByChannel,AOdata,NULL,NULL);

 

DAQmxStartTask(Ao0taskHandle);

DAQmxStartTask(Ao1taskHandle);

 

 

 

What happen as result of the code is that only the Ao0 channel get the sinwave output , but not the Ao1 . It seems the two channels are not synchronized.

 

What is wrong in my code?

 

Please any help non referred to a LabView soloution , first because I'm not a LavView programmder and secondly the project impose C++ as the unique environement.

 

Thanks

 

Enky

0 Kudos
Message 1 of 1
(5,628 Views)