18.11.2014 Views

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

The Microcontroller Idea Book - Jan Axelson's Lakeview Research

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Chapter 8<br />

Table 8-1. <strong>The</strong> forward voltage drop across an LED varies with the color.<br />

LED color<br />

typical forward voltage (volts)<br />

Table 8-1 shows typical forward voltages for different colors of LEDs. Typical LED<br />

operating currents are between 10 and 20 milliamperes. For a bright display with low power<br />

consumption, look for types labeled high efficiency.<br />

One disadvantage to LEDs is that the light from most is hard to detect in bright light,<br />

especially outdoors. A tinted, transparent sheet of plastic mounted over the display can make<br />

it more visible in bright light. For red LEDs, transparent red or purple works well.<br />

For best visibility over a wide area, look for LEDs with a wide viewing angle. This means<br />

that the LED emits light in a wide cone, so you don’t need to view it straight-on.<br />

LED Interfaces<br />

Red 1.6<br />

Green 2.0<br />

Yellow 2.0<br />

Blue 3.2<br />

Figure 8-1 shows examples of LED interfaces to output ports in an 8052-BASIC system.<br />

<strong>The</strong> outputs of the 80(C)52 and 82(C)55 can’t provide enough current to drive an LED<br />

directly. But you can drive an LED with a 74LS374 or 74HC374 latch (A, B), or with a<br />

buffer or inverter driven by any output port (C, D).<br />

With LSTTL drivers, you should design your circuit so that a low output turns on the LED,<br />

since LSTTL outputs can sink more current than they can source. With HCMOS or<br />

HCTMOS outputs, either a high or low output can turn on the LED.<br />

Use a series resistor to limit the current through the LED. For a brighter display, decrease<br />

the value of the resistor. Most LEDs can handle 20 milliamperes of continuous current. You<br />

can measure the current directly by connecting an ammeter in series with the LED and<br />

resistor. Or, you can calculate the current by measuring the the voltage across the series<br />

resistor and dividing it by the resistor’s value. For example, 2.25V/150 ohms = 0.015<br />

amperes, or 15 milliamperes.<br />

Both LSTTL and HCMOS devices are capable of 20-milliampere output currents. At these<br />

higher currents, the output voltage isn’t specified, but should be enough to light an LED.<br />

To turn on an LED at a port, write a 1 or 0, as appropriate, to the bit that controls it, as<br />

described in Chapter 6. Listing 8-1 assumes that you have eight LEDs connected to the<br />

126 <strong>The</strong> <strong>Microcontroller</strong> <strong>Idea</strong> <strong>Book</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!