228 8. ATMEL AVR OPERATING PARAMETERS AND INTERFACING
such as a 2N2222 (PN2222 or MPQ2222) may be used in place of the inverter as shown in the
figure. In Chapter 1, we used large (10 mm) red LEDs in the KNH instrumentation project. These
LEDs have V
f
of6to12VDCandI
f
of 20 mA at 1.85 VDC. This requires the interface circuit
shown in Figure 8.8c) right.
Vcc = 5 VDC
R
+
7404
from
micro
I
R
2
+
I
from
micro
R
1
Vcc = 5 VDC
220
+
I
from
micro
4.7K
Vcc = 9 VDC
Figure 8.8: LED display devices.
8.5.2 SEVEN SEGMENT LED DISPLAYS
To display numeric data, seven segment LED displays are available as shown in Figure 8.9(a).
Different numerals can be displayed by asserting the proper LED segments. For example, to display
the number five, segments a, c, d, f, and g would be illuminated. Seven segment displays are available
in common cathode (CC) and common anode (CA) configurations. As the CC designation implies,
all seven individual LED cathodes on the display are tied together.
The microcontroller is not capable of driving the LED segments directly. As shown in Figure
8.9(a), an interface circuit is required. We use a 74LS244 octal buffer/driver circuit to boost the
current available for the LED. The LS244 is capable of providing 15 mA per segment (I
OH
)at2.0
VDC (V
OH
). A limiting resistor is required for each segment to limit the current to a safe value for
the LED. Conveniently, resistors are available in DIP packages of eight for this type of application.
Seven segment displays are available in multi-character panels. In this case, separate micro-
controller ports are not used to provide data to each seven segment character. Instead, a single port
is used to provide character data. A portion of another port is used to sequence through each of
the characters as shown in Figure 8.9(b). An NPN (for a CC display) transistor is connected to the
common cathode connection of each individual character. As the base contact of each transistor is
sequentially asserted, the specific character is illuminated. If the microcontroller sequences through
the display characters at a rate greater than 30 Hz, the display will have steady illumination.
8.5. OUTPUT DEVICES 229
a
b
c
d
e
f
g
a
b
c
d
e
f
g
74LS244
octal buffer/
line driver
common cathode
7-segment display
(V
f
1.85 VDC @ I
f
12mA)
DIP
resistor
V
OH
: 2.0 VDC
I
OH
: 15 mA
R = (V
OH
- V
f
) / I
f
R = (2.0 - 1.85)/ 12 mA
R = 12.5 ohms
a) seven segment display interface
microcontroller port
a
b
c
d
e
f
g
a
b
c
d
e
f
g
a
b
c
d
e
f
g
a
b
c
d
e
f
g
74LS244
octal buffer/
line driver
numeral select
dp
a
b
c
d
e
f
g
(a)11
(b) 7
(c) 4
(d) 2
(e) 1
(f) 10
(g) 5
quad common cathode
7-segment display
MPQ2222
b) quad seven segment display interface
(6)
(8) (9)
(12)
(dp)3
(18)
(16)
(14)
(12)
(9)
(7)
(5)
(3)
(1)
(2)
(3)
(4)
(5)
(6)
(7)
(8)
(16)
(15)
(14)
(13)
(12)
(11)
(10)
(9)
10K
10K
10K
10K
(1)
(2)
(3)
(5)
(6)
(7)
(8)
(14)
(13)
(12)
(10)
(9)
PORTC[7]
PORTC[0]
PORTD[0]
PORTD[3]
a
b
c
d
e
f
g
a
b
c
d
e
f
g
a
b
c
d
e
f
g
a
b
c
d
e
f
g
12 7
1
6
d) quad seven segment display pinout
UN(M)5624-11 EWRS
0
1
2
3
4
5
6
7
8
9
dp PORTC[7]
a PORTC[6]
b PORTC[5]
c PORTC[4]
d PORTC[3]
e PORTC[2]
f PORTC[1]
g PORTC[0]
hex rep
1
0
1
1
0
1
0
1
1
1
1
1
1
1
1
0
0
1
1
1
1
1
0
1
1
1
1
1
1
1
1
0
1
1
0
1
1
0
1
0
1
0
1
0
0
0
1
0
1
0
1
0
0
0
1
1
1
0
1
1
0
0
1
1
1
1
1
0
1
1
numeral
0x7E
0x30
0x6D
0x79
0x33
0x5D
0x1F
0x70
0x7F
0x73
c) numeral to segment converion
5 VDC
(20)
(10)
(1)
/1G
(19)
/2G
Figure 8.9: Seven segment LED display devices.

Get Arduino Microcontroller, 2nd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.