7-Segment Displays - Computer Science and Engineering

Download Report

Transcript 7-Segment Displays - Computer Science and Engineering

7-Segment Displays
Module M7.2
Section 6.5
Turning on an LED
No c urrent
no light
R
LED
+5V
Common
Anode
light
Current
+1.7V
+5V
R
R=
+5V
GAL output pin
1
v oltage
=
c urrent
LED
+0.2V
GAL output pin
0
5 - 1.7
= 220 ohms
-3
15 x 10
Turning on an LED
No Current
0
GAL output pin
no light
0V
0V
R
Current
1
GAL output pin
R
voltage
current
=
light
0V
+1.7 V
+5 V
R=
LED
Common
Cathode
LED
5 - 1.7 = 220 ohms
15 x 10^-3
This is what
we use in Lab
7-Segment Display
7-Segment Display
a
f
b
g
e
c
d
0
1
2
3
4
5
6
7
a
1
0
1
1
0
1
1
1
b
1
1
1
1
1
0
0
1
c
1
1
0
1
1
1
1
1
d
1
0
1
1
0
1
1
0
e
1
0
1
0
0
0
1
0
f
1
0
0
0
1
1
1
0
g
0
0
1
1
1
1
1
0
7-Segment Display
a
f
b
g
e
c
d
8
9
A
b
C
d
E
F
a
1
1
1
0
1
0
1
1
b
1
1
1
0
0
1
0
0
c
1
1
1
1
0
1
0
0
d
1
1
0
1
1
1
1
0
e
1
0
1
1
1
1
1
1
f
1
1
1
1
1
0
1
1
g
1
1
1
1
0
1
1
1
K-Map for Segment e
K-Map for Segment e
e = D3 & D2 # !D2 & !D0 # D3 & D1 # D1 & !D0
D1 D0
00
D3 D2
00
D3 & D2
!D2 & !D0
01
11
1
10
1
01
1
11
1
10
1
1
1
1
1
1
D3 & D1
D1 & !D0
7seg.abl
MODULE seg7
Can’t start
with numbers
Z3..Z0
TITLE '7 Segment Decoder, A. Student, 7/12/02'
DECLARATIONS
" INPUT PINS "
Z3..Z0 PIN 6,7,11,5;
" Switch 1..4
Z = [Z3..Z0];
" 4-bit input vector
" OUTPUT PINS "
[A,B,C,D,E,F,G,DP] PIN 15,18,23,21,19,14,17,24 ISTYPE
'com';
Segments = [A,B,C,D,E,F,G];
“ 7-segment LED display
EQUATIONS
@radix 16;
" Identify the Hex Base
truth_table ( Z -> Segments )
" 7-segment display
0 -> 7E;
a b c d e
1 -> 30;
0 1 1 1 1 1
2 -> 6D;
HEX
1 0 1 1 0 0
3 -> 79;
2 1 1 0 1 1
4 -> 33;
3 1 1 1 1 0
5 -> 5B;
4 0 1 1 0 0
6 -> 5F;
5 1 0 1 1 0
7 -> 70;
6 1 0 1 1 1
8 -> 7F;
7 1 1 1 0 0
9 -> 7B;
8 1 1 1 1 1
0A -> 77;
9 1 1 1 1 0
0B -> 1F;
A 1 1 1 0 1
0C -> 4E;
b 0 0 1 1 1
0D -> 3D;
C 1 0 0 1 1
0E -> 4F;
d 0 1 1 1 1
0F -> 47;
E 1 0 0 1 1
END seg7
F 1 0 0 0 1
7seg.abl (cont’d)
f
1
0
0
0
1
1
1
0
1
1
1
1
1
0
1
1
g
0
0
1
1
1
1
1
0
1
1
1
1
0
1
1
1