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

5 views (last 30 days)
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 Comments
anon
anon on 4 Apr 2016
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.

Sign in to comment.

Answers (1)

Brandon Nichols
Brandon Nichols on 12 Mar 2014
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 Comment
apacala
apacala on 12 Mar 2014
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

Sign in to comment.

Categories

Find more on Periodic Waveform Generation in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!