LEC2 - 7segment - LED Matrix
LEC2 - 7segment - LED Matrix
LEC2 - 7segment - LED Matrix
Microprocessors
and Applications
Lecture 2
7 Segment
And LED Matrix
Outline
▪ Introduction.
▪ 7 Segment Display.
▪ 7 segment Projects.
▪ LED Matrix Display.
▪ LED Matrix Projects.
2
Introduction
▪ The microprocessor can do many things (with the help of some great
programming), but it is still an opaque black box.
3
7 Segment Display
4
7 Segment Display Connections
5
Common Cathode Configuration
6
Common Anode Configuration
7
Common Cathode Codes
8
Assembly Program Structure
9
7 Segment Project_1
10
Hardware Design
AD[0..7]
AD[0..15] U2 U3
AD0 3 2 AD0 34 4
AD[0..15] D0 Q0 D0 PA0
AD1 4 5 AD1 33 3
D1 Q1 D1 PA1
AD2 7 6 AD2 32 2
D2 Q2 D2 PA2
AD3 8 9 AD3 31 1
D3 Q3 D3 PA3
AD4 13 12 AD4 30 40
U1 D4 Q4 D4 PA4
AD5 14 15 AD5 29 39
D5 Q5 D5 PA5
21 AD6 17 16 AD6 28 38
RESET AD[0..15] D6 Q6 D6 PA6
22 AD7 18 19 AD7 27 37
READY A[16..19] D7 Q7 D7 PA7
24
INTA/QS1
18 25 1 5 18
INTR ALE/QS0 OE RD PB0
31 34 11 36 19
HOLD/GT1 BHE LE WR PB1
30 27 9 20
HLDA/GT0 DT/R/S1 A0 PB2
23 26 74HC373 8 21
TEST DEN/S2 A1 PB3
17 32 35 22
NMI RD RESET PB4
33 29 23
MN/MX WR/LOCK PB5
19 28 6 24
CLK M/IO/S0 CS PB6
25
PB7
8086
14
PC0
15
PC1
16
PC2
17
PC3
13
PC4
12
PC5
11
PC6
10
PC7
8255A
11
Assembly Program
12
7 Segment Project_2
▪ Design the hardware interface and write an 8086 assembly program
for a common cathode 7-segment LED-based counter that connected
to PORT A of the 8255A PPI.
▪ The counter counts up from 0 to 9 (and repeat) if a switch connected
to BIT0 of port B is pressed, and it counts down from 9 to 0 (and
repeat) if the switch is released.
▪ Use one second delay intervals between each two outputs.
13
Hardware Design
AD[0..7]
AD[0..15] U2 U3
AD0 3 2 AD0 34 4
AD[0..15] D0 Q0 D0 PA0
AD1 4 5 AD1 33 3
D1 Q1 D1 PA1
AD2 7 6 AD2 32 2
D2 Q2 D2 PA2
AD3 8 9 AD3 31 1
D3 Q3 D3 PA3
AD4 13 12 AD4 30 40
U1 D4 Q4 D4 PA4
AD5 14 15 AD5 29 39
D5 Q5 D5 PA5
21 AD6 17 16 AD6 28 38
RESET AD[0..15] D6 Q6 D6 PA6
22 AD7 18 19 AD7 27 37
READY A[16..19] D7 Q7 D7 PA7
24
INTA/QS1
18 25 1 5 18
INTR ALE/QS0 OE RD PB0
31 34 11 36 19
HOLD/GT1 BHE LE WR PB1
30 27 9 20
HLDA/GT0 DT/R/S1 A0 PB2
23 26 74HC373 8 21
TEST DEN/S2 A1 PB3
17 32 35 22
NMI RD RESET PB4
33 29 23
MN/MX WR/LOCK PB5
19 28 6 24
CLK M/IO/S0 CS PB6
25
PB7
8086
14
PC0
15
PC1
16
PC2
17
PC3
13
PC4
12
PC5
11
PC6
10
PC7
8255A
14
Assembly Program
15
Assembly Program Cont.
16
LED Matrix Display
17
LED Matrix Display
18
LED Matrix Display
19
LED Matrix Display
20
LED Matrix Display
21
LED Matrix Project_3
▪ Design the hardware interface and write an 8086 ALP to drive an
8×8 LED Matrix Display that connected to PORT A and PORT C .
▪ The columns are required to be illuminated sequentially as shown in
the figure below (and repeat – one second delay).
22
Hardware Design
AD[0..7]
AD[0..7] U2 U3
AD0 3 2 AD0 34 4
AD[0..15] D0 Q0 D0 PA0
AD1 4 5 AD1 33 3
D1 Q1 D1 PA1
AD2 7 6 AD2 32 2
D2 Q2 D2 PA2
AD3 8 9 AD3 31 1
D3 Q3 D3 PA3
AD4 13 12 AD4 30 40
U1 D4 Q4 D4 PA4
AD5 14 15 AD5 29 39
D5 Q5 D5 PA5
21 AD6 17 16 AD6 28 38
RESET AD[0..15] D6 Q6 D6 PA6
22 AD7 18 19 AD7 27 37
READY A[16..19] D7 Q7 D7 PA7
24
INTA/QS1
18 25 1 5 18
INTR ALE/QS0 OE RD PB0
31 34 11 36 19
HOLD/GT1 BHE LE WR PB1
30 27 9 20
HLDA/GT0 DT/R/S1 A0 PB2
23 26 74HC373 8 21
TEST DEN/S2 A1 PB3
17 32 35 22
NMI RD RESET PB4
33 29 23
MN/MX WR/LOCK PB5
19 28 6 24
CLK M/IO/S0 CS PB6
25
PB7
8086
14
PC0
15
PC1
16
PC2
17
PC3
13
PC4
12
PC5
11
PC6
10
PC7
8255A 23
Assembly Program
24
LED Matrix Project_4
▪ Design the hardware interface
and write an 8086 ALP to drive
an 8×8 LED Matrix Display that
connected to PORT A
and PORT C .
▪ All LEDs are required to be
illuminated at the same time
(although the circuit outputs
current to one column at a time).
25
Hardware Design
AD[0..7]
AD[0..7] U2 U3
AD0 3 2 AD0 34 4
AD[0..15] D0 Q0 D0 PA0
AD1 4 5 AD1 33 3
D1 Q1 D1 PA1
AD2 7 6 AD2 32 2
D2 Q2 D2 PA2
AD3 8 9 AD3 31 1
D3 Q3 D3 PA3
AD4 13 12 AD4 30 40
U1 D4 Q4 D4 PA4
AD5 14 15 AD5 29 39
D5 Q5 D5 PA5
21 AD6 17 16 AD6 28 38
RESET AD[0..15] D6 Q6 D6 PA6
22 AD7 18 19 AD7 27 37
READY A[16..19] D7 Q7 D7 PA7
24
INTA/QS1
18 25 1 5 18
INTR ALE/QS0 OE RD PB0
31 34 11 36 19
HOLD/GT1 BHE LE WR PB1
30 27 9 20
HLDA/GT0 DT/R/S1 A0 PB2
23 26 74HC373 8 21
TEST DEN/S2 A1 PB3
17 32 35 22
NMI RD RESET PB4
33 29 23
MN/MX WR/LOCK PB5
19 28 6 24
CLK M/IO/S0 CS PB6
25
PB7
8086
14
PC0
15
PC1
16
PC2
17
PC3
13
PC4
12
PC5
11
PC6
10
PC7
8255A 26
Assembly Program
27
LED Matrix Project_5
Display unit.
28
Hardware Design
AD[0..7]
AD[0..7] U2 U3
AD0 3 2 AD0 34 4
AD[0..15] D0 Q0 D0 PA0
AD1 4 5 AD1 33 3
D1 Q1 D1 PA1
AD2 7 6 AD2 32 2
D2 Q2 D2 PA2
AD3 8 9 AD3 31 1
D3 Q3 D3 PA3
AD4 13 12 AD4 30 40
U1 D4 Q4 D4 PA4
AD5 14 15 AD5 29 39
D5 Q5 D5 PA5
21 AD6 17 16 AD6 28 38
RESET AD[0..15] D6 Q6 D6 PA6
22 AD7 18 19 AD7 27 37
READY A[16..19] D7 Q7 D7 PA7
24
INTA/QS1
18 25 1 5 18
INTR ALE/QS0 OE RD PB0
31 34 11 36 19
HOLD/GT1 BHE LE WR PB1
30 27 9 20
HLDA/GT0 DT/R/S1 A0 PB2
23 26 74HC373 8 21
TEST DEN/S2 A1 PB3
17 32 35 22
NMI RD RESET PB4
33 29 23
MN/MX WR/LOCK PB5
19 28 6 24
CLK M/IO/S0 CS PB6
25
PB7
8086
14
PC0
15
PC1
16
PC2
17
PC3
13
PC4
12
PC5
11
PC6
10
PC7
8255A
29
Assembly Program
30
LED Matrix Project_6
31
Hardware Design
AD[0..7]
AD[0..7] U2 U3
AD0 3 2 AD0 34 4
AD[0..15] D0 Q0 D0 PA0
AD1 4 5 AD1 33 3
D1 Q1 D1 PA1
AD2 7 6 AD2 32 2
D2 Q2 D2 PA2
AD3 8 9 AD3 31 1
D3 Q3 D3 PA3
AD4 13 12 AD4 30 40
U1 D4 Q4 D4 PA4
AD5 14 15 AD5 29 39
D5 Q5 D5 PA5
21 AD6 17 16 AD6 28 38
RESET AD[0..15] D6 Q6 D6 PA6
22 AD7 18 19 AD7 27 37
READY A[16..19] D7 Q7 D7 PA7
24
INTA/QS1
18 25 1 5 18
INTR ALE/QS0 OE RD PB0
31 34 11 36 19
HOLD/GT1 BHE LE WR PB1
30 27 9 20
HLDA/GT0 DT/R/S1 A0 PB2
23 26 74HC373 8 21
TEST DEN/S2 A1 PB3
17 32 35 22
NMI RD RESET PB4
33 29 23
MN/MX WR/LOCK PB5
19 28 6 24
CLK M/IO/S0 CS PB6
25
PB7
8086
14
PC0
15
PC1
16
PC2
17
PC3
13
PC4
12
PC5
11
PC6
10
PC7
8255A
32
Assembly Program
33
Assembly Program Cont.
34
Assignment_1
▪ Design the hardware interface and write an 8086 assembly program
for a common anode 7-segment display that connected to PORT B.
▪ The program displays the letters A , E , F , H , L , and P (and repeat) if
a switch connected to BIT0 of PORT A is pressed.
▪ If the switch is released, the program displays dash “ – ” on the 7
segment.
▪ Use two seconds delay intervals between each two characters.
35
Assignment_2
▪ Design the hardware interface and write an 8086 assembly language
program to drive an 8×8 LED Matrix Display that connected to PORT
A and PORT B of the 8255A PPI.
▪ It is required to display the first three characters of your
Grandfather’s name on the LED Matrix Display (the letters are
required to appear consecutively on the LED Matrix).
▪ Use one second delay intervals between each two characters.
36
Video Tutorials
▪ 7 Segment Operation: https://www.youtube.com/watch?v=-Kf8AMuaOsY
▪ 7 Segment interfacing: https://www.youtube.com/watch?v=LseoDdRGDkA
▪ 7 Segment interfacing: https://www.youtube.com/watch?v=2TTIPVWw_CA
▪ LED Matrix Operation: https://www.youtube.com/watch?v=u8Ww0es7Qxo
▪ LED Matrix Operation: https://www.youtube.com/watch?v=2nPiv1l17yM
▪ LED Matrix Interfacing: https://www.youtube.com/watch?v=E0LTScYSLEE
▪ LED Matrix Interfacing: https://www.youtube.com/watch?v=h-RFotVR0Ek
37