KEMBAR78
MPU Lecture7 | PDF | Digital Technology | Computer Architecture
0% found this document useful (0 votes)
8 views4 pages

MPU Lecture7

Uploaded by

ekramhadizl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views4 pages

MPU Lecture7

Uploaded by

ekramhadizl
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Microprocessor, Lecture#7

Programmable Peripheral Interface (PPI 8255)

1. Introduction to the 8255 Programmable Peripheral Interface


 Widely used parallel, programmable input-output device.
 Designed to be a general-purpose I/O device that can be used with almost any microprocessor.
 Increase capacity of Input Output interface, it features up to 24 I/O line in a single IC.
 Operates in three primary modes.
 TTL Comptiable.
 It is a 40-pin integrated circuit (IC).

2. 8255 Pin Configuration


 D0 - D7: These are the data input/output lines for the device. All information read from and
written to the 8255 occurs via these 8 data lines.
 CS (Chip Select Input): If this line is a logical 0, the microprocessor can read and write to the
8255.
 RD (Read Input): Whenever this input line
is a logical 0 and the RD input is a logical 0,
the 8255 data outputs are enabled onto the
system data bus.
 WR (Write Input): Whenever this input
line is a logical 0 and the CS input is a
logical 0, data is written to the 8255 from the
system data bus.
 A0 - A1 (Address Inputs): The logical
combination of these two input lines
determines which internal register of the
8255 data is written to or read from.
 RESET: The 8255 is placed into its reset
state if this input line is a logical 1. All
peripheral ports are set to the input mode.
 24 IO Pins (PA0 - PA7, PB0 - PB7, PC0 - PC7): Used to connect IO Devices
 Power pins: Vcc (+5v), and gnd (0v)

1
Microprocessor, Lecture#7

Example: for the circuit below, determine the Address of ports and control register.
A1 A0 Selected Address
0 0 PORT A BCH [10111100]
0 1 PORT B BDH [10111101]
1 0 PORT C BEH [10111110]
1 1 Control Register BFH [10111111]

3. 8255 Block Diagram


 The 8255 has 24 IO line, organized into 3-8bit ports: Port A (PA), Port B (PB), and Port C (PC).
The 8255 IO ports can be grouped in two 12-bit groups:
1.Group A, it include Port A and Port C upper
2.Group B, it include Port B and Port C Lower
 The Data Bus Buffer buffers the data I/O lines to/from the MPU data bus.
 The Read/Write Control Logic receive control signals from MPU, control logic routes the data to
and from the correct internal registers with the right timing. The internal path being enabled
depends on the type of operation performed by the MPU. The type of operation can be I/O read or
I/O write.

2
Microprocessor, Lecture#7

4. 8255 Operating Modes


To know in which mode the interface is working we need to know the value of Control word.
Control word is a number to be loaded into control register in 8255 which specify an I/O function
for each port
 The MSB (D7) of Control Word specifies the
operation mode as follow:
4.1. BSR Mode – When MSB of the control
register is zero(0), 8255 works in Bit Set-Reset
mode. in this mode, only port C bits are used for
set and reset.
4.2. I/O Mode – When MSB of the control
register is one (1), 8255 works in Input-Output
mode. The I/O Mode is divided into three
categories (sub-modes):

4.2.1 Mode 0 (Basic I/O Mode)


 This is a basic or simple input/output mode
 All three ports (PA, PB, PC) can work as simple input function or output function.
 Ports don’t have handshake or interrupt capability.
 Output ports are latched, while inputs are not latched.
4.2.2 Mode 1 (I/O Mode with Handshake)
 There are two groups in this mode, group A and group B. They can be configured separately.
 Each group consists of an 8-bit port and a 4-bit port for handshaking.
 Input and output ports are latched.
 Interrupt logic is supported, and handshake signals are exchanged between CPU and peripheral
prior to data transfer.
 In this mode, Port C is called status port.
4.2.3 Mode 2 (Bidirectional I/O Mode with Handshake)
 This mode is applied for Port A only (with help of Port C).
 Port A can be set up for bidirectional data transfer using handshake signals from Port C.
 Port B can be set up either in mode 0 or mode 1.

PORT MODE 0 MODE 1 MODE 2 BSR MODE


PORT A YES YES YES NO
PORT B YES YES NO NO
PORT C YES NO [HS] NO [HS] YES

3
Microprocessor, Lecture#7

Exercises:
1:What are the function of the following control words:
a) 05h
b) 38h
c) 5Dh
2:For each of the following, determine the value of control word , and write instructions that
initializes 8255 assume the address of control register=73h:
a) Reset PC6
b) Set PC5
c) Set PC7
3:What are the function of the following control words:
a) 93h
b) 88h
c) 99h
4:What are the value of Control Word that:
a) Set PA: input, PB: output, PC: output, GA&GB: mode0
b) Set PA: output, PB: input, PCL: Output, PCU: input, GA&GB: mode0
Answer:
1.a) Control Word = 05h = 0 000 010 1  Set PortC.2
1.b) Control Word = 38h = 0 011 100 0  Reset PortC.4
1.c) Control Word = 5Dh = .………………..  .………………..

2.a) Reset PortC.6  Control Word = 0 000 110 0 = 0Ch


MOV AL , 0Ch
OUT 73h , AL

2.b) Set PortC.5  Control Word = 0 000 101 1 = 0Bh


MOV AL , 0Bh
OUT 73h , AL

2.c) Set PortC.7  Control Word = = ………… = …..h


.………………..
.………………..

3.a) Control Word = 93h = 1 0010 011  Configure PA as input port in mode 0, PCU as output port in
mode 0, PB as input port in mode 0, PCL as input port in mode 0.

3.b) Control Word = 88h = 1 0001 000  Initialize PA as output port in mode 0, PCU as input port in mode
0, PB as output port in mode 0, PCL as output port in mode 0.

3.c) Control Word = 99h = ………….  Set PA as ………port in mode ……, PCU as ………port in
mode …, PB as ………port in mode ….., PCL as ………port in mode …….
4.a) Set PA: input, PB: output, PC: output, GA&GB: mode0  Control Word = 1 0010 000 = 90h

4.b) Set PA: output, PB: input, PCL: Output, PCU: input, GA&GB: mode0  CW = ………… = …..h

You might also like