|
|||||||||||||||
How to control analog output from a CPLD using a pulse width modulatorThis article shows how a CPLD can replace a digital-to-analog converter, allowing it to drive an audio speaker or control things like LED intensity, motor speed, and servo position. Introduction Fig 1 shows a typical analog signal and its corresponding digital PWM representation. In general, an analog signal has maximum amplitude, minimum amplitude, and many levels in between. In contrast, the PWM only has two levels: maximum and minimum. 1. Analog signal and equivalent pulse-width modulation. (Click this image to view a larger, more detailed version) To convert from analog to digital, the analog signal first is sampled at a carrier frequency. For a given sample period, the area under the analog signal equals the area under the PWM pulse. The key principle behind the PWM is that a short pulse at maximum amplitude has the energy equivalent to a continuous analog signal at a lower amplitude. This simple equation determines the required sample frequency for a PWM circuit: ...where FSAMPLE is the rate at which the analog signal is divided into digital packets, and FRANGE is maximum frequency of the analog signal to be reproduced by the PWM. In the case of audio, for example, this may be 4 KHz for a phone or 20 KHz for an MP3 player. The "2" in the equation comes from the Nyquist frequency, which is the accepted oversampling rate required to reproduce an analog signal from digital samples. The next step is to generate a clock to drive the PWM granularity. The following equation determines the PWM frequency: ...where FPWM is the clock frequency driving the PWM block, and R is the resolution. The resolution is typically a multiple of 2N (where N = number of bits in the digital data stream words), however with the proposed MAX IIZ PWM, any resolution is possible.
|
Home | Feedback | Register | Site Map |
All material on this site Copyright © 2017 Design And Reuse S.A. All rights reserved. |