Interfacing With Periferals
Interfacing With Periferals
2
Description of 8255
•
A1 A0 Selected
0 0 0 Port A
0 0 1 Port B
0 1 0 Port C
0 1 1 Control register
1 X X Chip is not selected
3
Procedure of Interfacing
Hardware connection Steps
8085 8255 To communicate with 8255,
three steps are required
1. Determine the addresses of
Ports A, B, C and Control
Register according to chip
Decoded select logic and address lines
address A0 and A1
2. Write a control word in the
A0 A0 control register
A1 A1 3. Write instructions to
communicate with
peripherals through port A,
B, C
4
5
Modes of Operation
I/O Modes Bit Set/Reset Mode
• Mode 0: All ports function as simple • The BSR mode is used
I/O ports to set or reset the
• Mode 1: This is a handshake mode in bits in Port C
which six bits of Port C act as according to the
handshake signals. Two types of I/O control word written
data transfer; status check and in the control
interrupt; can be implemented. register.
• Mode 2: Port A can be set up for
bidirectional data transfer using
handshake signals from Port C and
port B can be set up either in Mode 0
or Mode 1.
6
7
8
Example : Mode 0: Identify control word
Identify Mode 0 control word to configure port A
and port CU as output ports and port B and port CL
as input ports.
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 0 0 0 1 1
I/O Port A in Mode 0 Port A = Port CU = Port B in Port B = Port CL =
function Output Output Mode 0 Input Input
= 83H
9
Example : BSR Mode : Identify control word
12
Example: Determine control word to set up
port A as input and port B as output in Mode 1
D7 D6 D5 D4 D3 D2 D1 D0
1 0 1 1 0 1 0 0
I/O Port A in Mode Port A PC6,7 Port B Port B Don’t
mode 1 as as in as care
input don’t mode output
care 1
= B4 H
13
Mode 2: Bidirectional Data Transfer
• This mode is used primarily in applications
such as data transfer between two computers.
• In this mode port A can be configured as
bidirectional port and port B either in Mode 0
or Mode 1
• Port A uses five signals from port C as
handshake signals for data transfer. The
remaining three signals from port C can be
used as simple I/O or as handshake for port B
14
Example: Mode 2 operation
15
Example: BSR Mode: Writing subroutine
Write a subroutine to set bits PC7 and PC3 and reset them after
10 ms (delay SR is available); control register address is 83H
16
Example: Chip Select Logic
17
18
1. Identify port address
2. Identify the Mode0 CW
to configure port A and
port CU as output ports
and port B and port CL
as input port
3. Write a program to
read the DIP switches
and display reading
19
20
Program
21