Are the light-emitting diodes (LEDs) in your design shining too brightly? Do you want to control the amount of voltage fed to a load, or vary the rotation speed or distance of a motor? Ever require an analog output from a digital device? You can accomplish all of these tasks through the use of pulse-width modulation (PWM) outputs. PWMs develop a duty cycle from a timer’s period in order to generate a modifiable rectangular pulse, which you can then use for a wide variety of applications including LED manipulation, power-supply regulation, communication protocol construction and variable signal generation. And instead of relying on a dedicated integrated circuit (IC), it is now possible to realize these functions using the MSP430™ family of microcontrollers (MCUs). TI is introducing a series of PWM TechNotes that describe how to perform simple PWM functions using cost-effective MSP430 value line MCUs:
- “UART Software Controlled RGB LED Color Mixing With MSP430 MCUs.”
- “Servo Motor Controller Using MSP430 MCUs.”
- “Stepper Motor Control Using MSP430 MCUs.”
- “Dual-Output 8-Bit PWM DAC Using Low-Memory MSP430 MCUs.”
These functions showcase the MSP430 MCU’s adaptability in a wide range of applications for which you may not have traditionally considered embedded MCUs; their low-power characteristics can offer a distinct benefit that some traditional ICs lack. For example, the “Dual-Output 8-Bit PWM DAC Using Low-Memory MSP430 MCUs” TI TechNote demonstrates a two-channel, 8-bit digital-to-analog converter (DAC) using the MSP430FR2000. The Timer_B module generates two PWM outputs using separate capture compare modules. The first PWM output generates a 250Hz sine wave from a 32-element look-up table, while the second generates a static DC voltage. Passive filters help construct the digital signal outputs into their analog counterparts as seen in Figure 1.
Figure 1: PWM DAC output
You can easily customize these outputs to the specifications of a desired application by changing DAC output modes, altering the values stored within the waveform’s look-up table, or accessing a different clock source or low-power mode (LPM). And because the MCU is programmable, it can also incorporate more capabilities besides the function described, providing versatility that enables the replacement of analog DACs where price or flexibility might be of concern. The possibilities are endless, as the same principles apply to all of the functions described in the PWM TI TechNotes category.
Every PWM function promotes the low-cost MSP430FR2000 MCU, which alongside other MSP430FR21xx devices is available in a 16-pin thin-shrink small outline package (TSSOP) and a 24-pin very thin quad flat no-lead (VQFN) package. With 29-cent suggested resale prices at 1,000 units – as low as 25 cents in higher volumes – these MCUs enable a programmable alternative to many of today’s fixed-function ICs.
- Read the other blogs in this series to learn more about the full series of TI TechNotes aimed at replicating simple functions using MSP430 value line MCUs.
- Download the e-book, which is the complete collection of TechNotes, along with a device migration guide and code-optimization techniques.
- Watch the 25 functions for 25 cents video series.
- Need technical support or have a function idea that isn’t listed? Visit the MSP430 E2E Forum or leave a comment below to let us know about it.