You are on page 1of 19

8255 Programmable Peripheral

Interface
8255 Programmable Peripheral Interface
 Used to interface the peripherals devices with µp.
 40 pin DIL package and operates with single +5V
DC supply
 Three 8-bit namely PORT A,PORT B and PORT C
Port C subdivided into two 4 bit port
C upper(PC7-PC4) and C lower (PC3-PC0)
 Two groups-
Group A: Port A and port C(upper)
Group B: Port B and port C(lower)
8255 Programmable Peripheral Interface
A1 A0 Selected
0 0 PORT A
0 1 PORT B
1 0 PORT C
1 1 Control register
Operation modes of 8255
BIT SET/RESET MODE:
The PORT C can be Set or Reset by sending OUT
instruction to the CONTROL registers.
I/O MODES:
•MODE 0(Simple input / Output):-In this mode , port A,
port B and port C is used as individually (Simply).
•MODE 1 :(Input/output with Hand shake):-In this
mode, input or output is transferred by hand shaking
Signals.
8255 Operation modes
 MODE 2:bi-directional I/O data transfer:
• This mode allows bidirectional data transfer over a
single 8-bit data bus using handshake signals.
• This feature is possible only Group A
• Port A is working as 8-bit bidirectional.
• PC4-PC7 is used for handshaking purpose.
• Mode 0 : Simple I/O
• Any of A, B, CL and CH can be programmed as input or
output
• Mode 1: I/O with Handshake
• A and B can be used for I/O
• C provides the handshake signals
• Mode 2: Bi-directional with handshake
• A is bi-directional with C providing handshake signals
• B is simple I/O (mode-0) or handshake I/O (mode-1)
• BSR (Bit Set Reset) Mode
• Only C is available for bit mode access.
• Allows single bit manipulation for control applications
Control Word Format in I/O Mode
1 D6 D5 D4 D3 D2 D1 D0 GROUP B
PORT C (LOWER)
1=I/P, 0=O/P
PORT B
1=I/P, 0=O/P
MODE SELECTION
0 = MODE 0
1 = MODE 1

GROUP A
PORT C (UPPER)
1=I/P, 0=O/P
PORT A
1=I/P, 0=O/P
MODE SELECTION
00 = MODE 0
MODE SET FLAG 01 = MODE 1
1 = ACTIVE 1X = MODE 2
 What will be the control word to intialise 8255
in following modes:
Port A-mode 0- input
Port B-mode 0-output
Port Cupper-mode 0-output
Port Clower-mode 0-input
Sol: 91H
 What will be the control word to initialize 8255 in following
modes:
Port A-mode 0- input
Port B-mode 0-input
Port Cupper-mode 0-input
Port Clower-mode 0-input

 What will be the control word to initialize 8255 in following


modes:
Port A-mode 0- output
Port B-mode 0-output
Port Cupper-mode 0-output
Port Clower-mode 0-output
Write a program to initialize 8255 in the configuration
below.(assume address of the CW register as 83H).
(1) Port A: simple input (2) Port B: simple output
(3) Port CL: output (4)Port CU: input
• Solution:
= 98H
1 0 0 1 1 0 0 0

Program:
MVI A,98H ; LOAD CONTROL
WORD

OUT 83H ; SEND CONTROL


WORD
Write a program to initialize 8255 in the configuration below.
(assume address of the CW register as 23H).
(1) Port A: output with handshake
(2) Port B: input with handshake
(3) Port CL: output (4)Port CU: input

• Solution:
1 0 1 0 1 1 1 0
= AEH
Program:
MVI A,AEH ; LOAD CONTROL
WORD

OUT 23H ; SEND CONTROL


WORD
Control Word Format in BSR Mode
0 D6 D5 D4 D3 D2 D1 D0
BIT SET/RESET
1 = SET
0 = RESET
DON’T CARE

BIT SELECT

0 1 2 3 4 5 6 7
0 1 0 1 0 1 0 1 B0
0 0 1 1 0 0 1 1 B1
0 0 0 0 1 1 1 1 B2

BIT SET/RESET FLAG


0 = ACTIVE
 PA can be set for Modes 0, 1, 2.
 PB for 0,1 and
 PC for mode 0 and for BSR.
 C has 2 4-bit parts: PC upper (PCU) and PC
lower (PCL), each can be set independently for
I or O. Each PC bit can be set/reset individually
in BSR mode.
 Write a set of instructions to perform the
following
(a)Set bit of port C (b) reset bit 4 of port C
Assume the address of PA=10H,PB=12H, PC=14H
and control register=15H
Sol:
(a)09 MVI A,09H
OUT 15H
(b) 08 MVI A,08
OUT 15H
Applications
 LED/relay interface
 Keyboard interface
 Display interface
 ADC/DAC interface
 Stepper motor interface
 Traffic signal controller
 Lift controller
Interfacing of 8255 with 8085
using IO mapped IO
 Scheme:- IO mapped IO scheme
 Microprocessor used:- 8085
 Calculation of CWR
 Calculation of port addresses
 Interfacing diagram

You might also like