DAQ multiple rates with digital output
3 次查看(过去 30 天)
显示 更早的评论
I need to generate pulses to synchronize the DAQ board analog output with other two devices through TTLs. I am using the following code
s = daq.createSession('ni');
s.Rate = 1000;
%Add analog output channels
s.addAnalogOutputChannel('Dev1',0:1,'Voltage');
s.IsContinuous = false;
%Add digital outputs to trigger external devices
DO1 = s.addCounterOutputChannel('Dev1',0,'PulseGeneration');
DO1.Frequency = s.Rate;
DO1.DutyCycle = 0.1;
DO2 = s.addCounterOutputChannel('Dev1',1,'PulseGeneration');
DO2.Frequency = s.Rate/100;
DO2.Frequency = s.Rate;
DO2.DutyCycle = 0.01;
s.queueOutputData([linspace(-1,1,100) linspace(-1,1,100)]);
s.startForeground;
s.stop;
release(s);
clear s
The code runs and it performs the desired outputs, but the pulses DO1 and DO2 are not synced (as checked in a fast oscilloscope), although the analog output and DO1 are synced. I asked a colleague to write a simple "program" in labview (to output two TTLs at 1KHz and 10Hz) and we clearly observe that the two ouputs are synced, so it looks like some sort of bug in Matlab. Anyone has seen a similar issue?
0 个评论
回答(1 个)
Sivapriya Srinivasan
2023-9-7
Hello ,
I understand that you are experincing synchronzation issues with the digital output channels while generating pulses using DAQ toolbox
1.Ensure the devices are synchronized with the same clock
2.Refer to the specifications of your DAQ board to ensure it supports simultaneous updates of multiple output channels
3.Adjust the buffer and latency settings in your code so that there are no delays affecting the synchronization
For further assistance please provide more information about your hardware setup and any error messages you encounter
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Data Acquisition Toolbox Supported Hardware 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!