Data Acquisition Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
Trevor.H

0% PWM duty cycle with DAQmx

Status: New

When doing PWM with DAQmx, error -200684 is thrown if a 0% duty cycle is attempted.  For situations where a true 0% is needed, this is problematic. There are a few workarounds available, but some are less than ideal.  

 

The suggestion here is to pause the output if a 0% duty cycle is attempted.

Trevor H.
Technical Support Engineer
National Instruments
2 Comments
_aniket72
Member

Hello Trevor.H,

 

We have 2 cases over here

0% duty cycle = Idle Low output.

100% duty cycle = Idle High output.

 

It will be very good idea if both are provided.

Aniket Ramesh Gadekar
Kevin_Price
Proven Zealot

I'm basically in favor of this idea, but wanted to add a couple thoughts:

 

1. In many cases, one can make a duty cycle that's well below 0.001 or above 0.999.  For example, if even if generating 15 kHz PWM for a servo drive, you can still cover the range 0.0002 - 0.9998.   Many (I dare say most) physical systems on the other side of that PWM won't show any difference in response to such small increments away from true 0 and 1.

 

2. Thus, a pretty good possible alternative would be to coerce requests for true 0 and 1 to the closest realizable duty cycle.  I.E., 2 ticks in one state, all the rest of the ticks (for the given frequency) in the other state.

   Any such coercion should return at least a warning.

 

3. Something analogous used to be applied to low time / high time parameters back around DAQmx 9.something.  One could request 0 and the API would instead coerce to the minimum allowable interval.  I got burned on this when an old app started throwing errors after installing a newer DAQmx driver which started returning errors instead of coercing.

 

4.  Curiously, the 'initial delay' parameter still gets coerced.  You can request 0 and you'll get whatever the minimum is for your timebase.

 

 

-Kevin P

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).