Beruflich Dokumente
Kultur Dokumente
I/O Interfacing
Issued by
p
A1
0
0
1
1
Note
A0
0
1
0
1
Port A
Port B
Port C
Control Register
=98 H
By transferring 98H to control Register of 8255
will configure 8255 in the above manner.
How -? We shall see after interfacing of 8255 with
8051.
74LS373
OC
VCC
1Q
8Q
1D
8D
2D
7D
2Q
7Q
3Q
6Q
3D
6D
4D
5D
4Q
5Q
GND
ENABLE
20
19
18
17
16
15
14
13
9
10
12
11
Input - 1D to 8D
Output - 1Q to 8Q
When Enable = 1
Input is Tracked.
=0
Input is Latched.
When Output Control (OC) = 0 latched output
is present on
output
1
2
3
4
5
20
19
18
17
8282
16
6
7
8
9
10
or
15
8283 14
13
12
11
VCC (+ 5V)
DO
DO
0
DO
1
DO
2
DO
3
DO
4
DO
5
DO
6
STB
7
P2
A8
A15
Addres
s
Decod
er
A2 A7
WR
CS
8255
A0
A1
8051
ALE
AD0
P0 AD7
74LS373
Or
8282
D0 D7
A0 A7
R
D
A15
A14
A13
A12
A11
A10
A9
A8
CS of 8255
A7
A6
A5
A4
A3
A2
A7
0 0 0 0 0 0 0 0 0 0 1 1
0 0 0 0
A6
A5
A4
A3
A2
CS
Problem -2
If 8255 address = 1110H
Then what will be decoding
Decoder 74LS138 may also be used.
A15
A12
1 1 1 0
0 0 0 0
A15
0 0
0 0 0
A1
0
A0
A14
A13
A12
CS of
8255
A11
A10
OR
A9
A8
Decoding of 8255 Address E000H to generate chip select
MOV DPTR,
# PRCR
MOV A, # 82H
MOVX @DPTR, A
To read data from Port B
MOV DPTR,
# PRB
MOVX A,@DPTR
To write data to Port A
MOV DPTR,# PRA
MOV A,# Data
MOVX @DPTR, A
Keyboard interfacing
Basic keyboard operation is shown in figure
IN
High
OUT 1
IN
OUT 2
OUT 1
OUT 2
IN
OUT 3
OUT 4
(1)
OUT1
IN1
(2)
(3)
IN2
(4)
OUT2
The codes of keys of key board may be stored row wise is 8255.
XX1
XX2
XX8
Start
I
Yes
Determine the
column number and
the code of the key
No
I
No
I+1
I>8
?
Yes
Key Debouncing
Fig-33
LED Interface
LED i.e Light Emitting Diode
emits light energy when conducts
Anode is held at higher voltage than cathod
+5 V
LED operation.
Port
Bit 7
Bit 0
Microprocessor interface to LED (common cathode)
Common Anode
[ Port bit = 0
LED Conducts
i.e glows ]
Bit 7
Bit 0
+5 V
Microprocessor interface to LED (common anode).
a
f
a
b
g
c
e
d
0
a
b
h
6
0
f
a
Parallel interface
+5 V
Anode
Resisters
Out port
7
6
0
Microprocessor interface to seven-segment LED (parallel interface).
+5V
Anode
a
f
e
a
MSB
h
h
Resisters
LSB
Shift register
Code bits
Clock
Microprocessor interface to seven-segment LED(serial interface)
Load clock
Load next bit
No
Load clock
Seventh
bit loaded
?
Yes
Stop
21 1
h
c
5
00
g
b
f
3
0
a
b
for common anode configuration .
c d e f
g h