Zibb

Design Idea

Microcontroller produces analog output

Edited by Bill Travis

By Abel Raynus, Armatron International, Melrose, MA -- EDN, 10/16/2003

A brushless dc motor needs several voltage levels to control its speed: 0V to stop the motor, 5V to run it at maximum speed, and some voltages between these extremes to run it slower. When you use such a motor in a system under microcontroller supervision, the microcontroller should generate all these voltages. But a microcontroller is a digital device, and it usually has no analog output. Several methods are available to overcome this deficiency. For example, you could use a DAC, a digitally programmable potentiometer, or some analog switches connected to resistor dividers. However, when you need only a few intermediate voltage levels, it would be more attractive to find a method that uses microcontroller software. This Design Idea exploits the fact that you can program a microcontroller's I/O pins as either input or output. When you program a pin as output, you set its voltage level to high (5V) or low (0V). When you program a pin as input, it has no effect on output voltage. Figure 1 shows a circuit example.

The circuit needs no external components, except for a few resistors. You can set the output-voltage levels during the main program execution or by an external interrupt. For testing purposes, using an external interrupt is preferable (see Listing 1). A pushbutton-mode switch triggers the external interrupt, the service routine of which consequently sets all the predetermined voltages. This design uses 0, 1.25, 2.5, 3.33, and 5V levels. Resistors R1 to R4 determine the intermediate levels. The circuit uses the inexpensive, 8-bit MC-68HRC908JK1 flash microcontroller from Motorola (www.motorola.com), but this method applies to almost any kind of microcontroller.



Reed Business Information Resource Center

Featured Company


Most Recent Resources

ADVERTISEMENT

ADVERTISEMENT

Feedback Loop


Post a CommentPost a Comment

There are no comments posted for this article.

Related Content

 

By This Author


ADVERTISEMENT

Knowledge Center



Technology Quick Links

EDN Marketplace


©1997-2009 Reed Business Information, a division of Reed Elsevier Inc. All rights reserved.
Use of this Web site is subject to its Terms of Use | Privacy Policy

Please visit these other Reed Business sites