Synchronize two digital outputs or digital counter outputs on the same device with ni-daqmx

10 次查看(过去 30 天)
I have the NI PCIe-6321 DAQ and I am trying to output two pulse trains (100kHz PWM) on two separate counter channels that are synchronized (phase aligned) but with different duty cycles and start delay times. It is straightforward to get the two counters outputting at the proper frequency and duty cycle, but I am struggling to figure out a way to synchronize them.
It is unclear if this is even possible with the X-series devices running the session interface in matlab. This comment makes me think it may not be possible:
"Note: Counter output channels run independently and are unaffected by synchronization connections." -http://www.mathworks.com/help/daq/automatic-synchronization.html
I would think this was a common problem for anyone doing 3-phase PWM control with Ni-DAQmx, but I have found very little information on it. I would love some advice. If it isn't possible, would an M or E series device give me this capability?
An alternative approach would be to use a single internal (or external) trigger coordinating 2 different digital output channels. Is this a workable alternative approach?
I'm running R2013a 64bit.
  5 个评论
anon
anon 2016-4-4
As I recall (it's been two years), mathworks provided me with a custom library that enabled this functionality. It worked great and I wanted to post the solution here, but they requested that I not since it is an untested feature. Go figure...
I would suggest you contact their support directly for the code they provided me as I no longer have it.

请先登录,再进行评论。

回答(1 个)

Brandon Nichols
Brandon Nichols 2014-3-12
You can synchronize them by using the rising edge of the first channel to trigger the second channel. There is unfortunately no way that I've found to change the start delay time if you synchronize them this way, so I'm not sure this helps you all that much.
  1 个评论
apacala
apacala 2014-3-12
Could I use the falling edge of the first channel?
Do you have example code of how to set up the trigger properly or a link to a helpful document about the trigger functions in Ni-DAQmx?
Thanks

请先登录,再进行评论。

类别

Help CenterFile 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!

Translated by