Data Acquisition (DAQ) and Control from Microstar Laboratories

Knowledge Base: Output

  • See the list of other topics for category Output

Q10013 Using PWM command for driving output signals

Tags: Help, DAP, control, output, PWM, power

Applies to: All DAP models supporting digital outputs

I need to control a power device, using a pulse-modulated power driver. Can I use the PWM command for this?

The PWM command might work for this, as long as you understand the restrictions.

The PWM command currently is unidirectional only. For some kinds of applications, like pump or motor speed applications requiring sustained drive, this is fine. Pulses are either positive high or zero, like a single digital logic bit. This is in fact how the outputs are encoded. You can use the digital bit to drive the switching circuit of your power amplifier.

The current implementation works this way. You specify the desired output level as "duty cycle" ranging from minimum to maximum. The command will generate pulses at the rate controlled by a stream of timing samples, typically from sampling activity. The PWM command switches the selected digital port bit so that the signal is "on" in proportion to duty cycle level. Because of the discrete timing, the output level is an exact match only over a long time interval.

Bidirectional PWM is not supported, but then again, nobody has asked for it! This is useful for applications need switching logic that is positive, negative, or zero. Typically, the output is a bipolar analog signal driving a power H-bridge amplifier. A typical application is positioning, where it takes firm effort to establish a position, but then minimal effort to maintain it.

Pulse-width modulation in general doesn't work well near the limits of operation, due to the limits of resolution. As an extreme example, holding a system very near zero at 0.1% of the range must result in one positive pulse per 999 zero values. The system will receive sporadic jolts that will not very accurately approximate a DC level of 0.1% loading. Resolution is better at higher switching rates, but high rates can consume a disproportionate amount of DAP resources.


See PWM command in DAPL 3000 Manual (PDF)