8255 PPI
Programmable Peripheral Interface
Introduction
• MPU interface to external devices through both parallel and serial
interfaces.
• Parallel data occur in system that use:
– Displays
– Keyboard
– Printers (old printer)
– Etc.
• Serial data occurs in:
– Some printers
– Data communications
About
• 24 I/O pins
• 8 bit parallel ports: A, B
• C port: can be grouped as 4 bit CU(C upper) and
CL(C Lower)
• Two Modes: BSR(Bit Set/reset) and I/O mode
• BSR mode set/reset in port C
• I/O mode is further divided in 3 modes:
– Mode 0: simple
– Mode 1: Handshake
– Mode 2 : Bidirectional
Pin Diagram
Function of pins:
• Data bus(D0-D7):These are 8-bit bi-directional buses,
connected to 8085 data bus for transferring data.
• CS: This is Active Low signal. When it is low, then
data is transfer from 8086.
• Read: This is Active Low signal, when it is Low read
operation will be start.
• Write: This is Active Low signal, when it is Low Write
operation will be start.
Function of pins:
• Address (A0-A1):This is used to select the
ports. like this
A1 A0 Select
0 0 PA
0 1 PB
1 0 PC
Control
1 1
reg.
Function of pins:
• RESET: This is used to reset the device. That means clear
control registers.
• PA0-PA7:It is the 8-bit bi-directional I/O pins used to send
the data to peripheral or to receive the data from peripheral.
• PB0-PB7:Similar to PA
• PC0-PC7:This is also 8-bit bidirectional I/O pins. These lines
are divided into two groups.
– PC0 to PC3(Lower Groups)
– PC4 to PC7 (Higher groups)
These two groups working in separately using 4 data’s.
Block Diagram
Block Diagram
Group A
Group A: PA0-PA7
PC4-PC7
Group B: PB0-PB7
PC0-PC3
Group B
Figure 3:
Control Word
• Can be accessed when A0=1 and A1=1
• Cannot be accessed for read operation
• Steps to communicate with 8255
– Determine the addresses of port A,B and C and
control register according to CS and A0 ,A1
– Write control word in control register
– Write I/O instruction to communicate with
peripheral through A,B and C
Control Word
Mode 0: Simple Input or Output
• In this mode, ports A, B are used as two
simple 8-bit I/O ports and port C as two 4-bit
ports. Each port can be programmed to
function as simply an input port or an output
port. The input/output features in Mode 0 are
as follows.
– Outputs are latched.
– Inputs are not latched.
– Ports don’t have handshake or interrupt
capability.
• Example :
PROBLEM: 15.1
1. Identify port address
2. Identify the mode 0 control word to configure port A and port Cu as output
port and port B and port CL as input.
3. Write a program to …………………………………….
Figure 9:
8255 PIA: Example
• Solutions:
– Port Address :
• It is actually an I/O memory map.
• When A15 is active high, Chip Select signal is activated.
• Assuming all don’t care signals are at logic 0, therefore ports’
address are as follows:
8255A Programmable Peripheral Interface
• Solution:
– Control Word:
8255 PIA
• Solution: ???
Program:
MOV AL, 83H
MOV DX, 8003H
OUT DX, AL
IN AL, 8001H
OUT 8000H, AL
IN AL, 8002H
SHL AL,4
OUT 8002H, AL