The supported Altera devies are an excellent choice for implementing power control using pulse width modulation. Their low power, quick power-on, and unique internal oscillator are essential to pulse width control systems, making them ideal programmable logic devices.
In PWM, the time period of the square wave is kept constant and the time for which the signal remains high is varied or modulated. The duty cycle and average DC value of the signal can be varied. PWM provides a powerful method for controlling analog circuits with the help of an output from a digital system. A few applications of PWM technique include:
- Telecommunication—Data corresponding to particular pulse widths is encoded at one end and decoded at the other end.
- Voltage regulation—The output voltage in a voltage regulator system can be controlled to a desired level by varying the duty cycle.
- Power delivery—You can vary the average power delivered, which is a function of the modulated duty cycle.
- Audio Effects and Amplification—Used in sound synthesis.
You can visually observe PWM with intensity variation in LEDs, which are known for their fast switching speeds. Intensity variation in the LED is an outcome of the variation in average DC voltage and the current through the LED due to PWM.
The detailed description of the implementation is based on the MAX II devices. This application can also be implemented in MAX V and MAX 10 devices.
The up and down input signals are used to vary the duty cycle of the output signal. The first module is used to generate two clocks of different frequencies with the available internal user flash memory oscillator in MAX II devices. The 4-bit output signal from the DUTY_CYCLE module has positive or negative incrementation, depending on whether up or down is asserted. The second 4-bit output signal COUNT (reference counter) is incremented continuously at the higher clock frequency generated in the first module. This signal is compared to DUTY_CYCLE at the same frequency in the second module. The result of the comparison, which is a single bit, is assigned to the final output signal PWM.
The inputs to the PWM are comprised of up and down signals used to vary the duty cycle of the output signal. The device uses two basic modules to realize the working of the PWM. All input and output signals are of a single bit.
The 4-bit variable signal DUTY_CYCLE allows 16 different variations in the duty cycle of the output signal. In this design implementation, input up has a higher priority over down. If both are high at the same time, the output signal sees an increase in its duty cycle.
You can implement this design example with an EPM240, or any other MAX II devices, and observe results by controlling the intensity of mono-color (red) LEDs and varying color shades of bi-color (red/green) LEDs on the MDN-B2 demo board. Implement this design with the design example source code and allocate the appropriate control and output lines to the GPIO lines of the MAX II device that are connected to LEDs. The red LEDs are driven by the PWM output, which causes their intensities to vary. The bi-color LEDs are driven by two mutually complementary signals: PWM and PWM_INV. The frequency of operation causes the phenomenon of persistence of human vision. This creates a small spectrum of colors involving the two individual colors of the bi-color LEDs, while their individual intensities are varied corresponding to the PWM signal. You can operate two push-button switches on the demo board to gradually create the small spectrum of colors. This also illustrates the change in the duty cycle of the output signal because of the varied intensity of the single-color LED.
To demonstrate the design example on the MDN-B2 demo board, follow these steps:
- Turn on the power to the demo board (using slide switch SW1).
- Download the design to the MAX II device through the JTAG header JP5 on the demo board and a conventional programming cable (ByteBlaster™ II or USB-Blaster™).
- Keep SW4 on the demo board pressed before and during the start of the programming process. Once complete, turn off the power and remove the JTAG connector.
- Switch on the power to the demo board (using the slide switch SW1) and observe intensity variations in red LEDs when the up and down (SW9/SW8) push buttons on the MDN-B2 demo board are pushed.
- Bi-color LED D7 indicates different combinations of red and green colors with varying PWM output.
|December 2007||1.0||Initial release.|