0% found this document useful (0 votes)
13 views29 pages

Module 4 - 8255A - PPI V1.0

The document provides an overview of the Intel 8255A Programmable Peripheral Interface, detailing its architecture, pin descriptions, operational modes, and control word register functionalities. It explains how the 8255A can be configured for various input/output operations using its multiple ports and modes, including Bit Set/Reset mode, Mode 0 (Simple I/O), Mode 1 (Strobe/Handshake), and Mode 2 (Bi-Directional). Additionally, it includes examples of programming the 8255A for specific configurations and operations.

Uploaded by

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

Module 4 - 8255A - PPI V1.0

The document provides an overview of the Intel 8255A Programmable Peripheral Interface, detailing its architecture, pin descriptions, operational modes, and control word register functionalities. It explains how the 8255A can be configured for various input/output operations using its multiple ports and modes, including Bit Set/Reset mode, Mode 0 (Simple I/O), Mode 1 (Strobe/Handshake), and Mode 2 (Bi-Directional). Additionally, it includes examples of programming the 8255A for specific configurations and operations.

Uploaded by

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

PRESIDENCY UNIVERISTY,

BENGALURU
School of Engineering

Microprocessors and Microcontroller


CSE 206

IV Semester 2018-19
Module – 4

Programmable Peripheral
Interfacing
Intel 8255A – Programmable Peripheral
Interface
• The parallel input-output port chip 8255 is also called as
programmable peripheral input- output port.
• The Intel’s 8255 is designed for use with Intel’s 8-bit, 16-bit
and higher capability microprocessors.
• It has 24 input/output lines which may be individually
programmed in two groups of twelve lines each, or three
groups of eight lines.
• The two groups of I/O pins are named as Group A and
Group B. Each of these two groups contains a subgroup of
eight I/O lines called as 8-bit port and another subgroup of
four lines or a 4-bit port.
• Thus Group A contains an 8-bit port A along with a 4-bit
port. C upper.
Intel 8255A – Programmable Peripheral
Interface
• The port A lines are identified by symbols PA0-PA7 while
the port C lines are identified as PC4-PC7. Similarly, Group
B contains an 8-bit port B, containing lines PB0-PB7 and a
4-bit port C with lower bits PC0- PC3.
• The port C upper and port C lower can be used in
combination as an 8-bit port C. Both the port C are
assigned the same address.
• Thus one may have either three 8-bit I/O ports or two 8-bit
and two 4-bit ports from 8255. All of these ports can
function independently either as input or as output ports.
• This can be achieved by programming the bits of an
internal register of 8255 called as control word register
(CWR). This buffer receives or transmits data upon the
execution of input or output instructions by the
microprocessor.
• The control words or status information is also transferred
through the buffer.
Intel 8255A – Architecture
Intel 8255A – Pin Description

•PA0 – PA7 – Pins of port A


•PB0 – PB7 – Pins of port B
•PC0 – PC7 – Pins of port C
•D0 – D7 – Data pins for the
transfer of data
•RESET – Reset input
•RD’ – Read input
•WR’ – Write input
•CS’ – Chip select
•A1 and A0 – Address pins
Intel 8255A – Pin Description
It is a 40 pin IC which operates on +5V power supply. These 40
pins are described in the following sections.
1. D0-D7 (Data bus): These are 8-bit bidirectional data bus,
connected to system data bus for data transfer between 8086
and 8255. On these data lines 8086 will send control word data
to initialize 8255, send data or read data.
2. RD- (Read): This is for read operation. It is active low signal
which is input to the 8255. A low on this input pin enables the
8255 to send the data or status information to the CPU on the
data bus. In essence, it allows the processor to read from the
8255.
3. WR- (Write): This is for write operation. It is active low signal
which is input to the 8255. A low on the input pin enables the
CPU to write data or control words into the 8255.
Intel 8255A – Pin Description
4. RESET: This signal is used to reset the 8255. A high on this input
signal clears the control register and all ports (A, B, C) are set to
the input mode. This signal is connected to the reset out of 8085
and reset signal of the clock generator of 8086.
5. Ports A, B, and C: The 8255A contains three 8-bit ports (A, B,
and C). All can be configured in a wide variety of functional
characteristics by the system software but each has its own
special features that further enhances the power and flexibility of
the 8255A.
Port A: One 8-bit data output latch/buffer and one 8-bit data
input latch.
Port B: One 8-bit data output latch/buffer and one 8-bit data
input buffer.
Port C: One 8-bit data output latch/buffer and one 8-bit data
input buffer (no latch for input).
Intel 8255A – Pin Description
Port C can be divided into two 4-bit ports under the mode
control. Each 4-bit port contains a 4-bit latch and it can be
used for the control signal outputs and status signal inputs in
conjunction with ports A and B.
6. A0 and A1 (Address lines): These two A1 A0 Port
input signals were connected with the A1 0 0 PA
and A0 address lines of the demultiplexed 0 1 PB
address lines. These two signals will give 1 0 PC
the addresses of the port addresses and the 1 1 CWR
CWR as follows:
7. cs- (Chip select): A low on this signal select the chip. The
chip select signal generated by the A2-A, address lines (in case
of IO mapped IO) or A2-A15 address lines (in case of Memory
mapped IO) is connected to this signal. The combination of
these address lines along with the A1-A0 generates the actual
8-bit or the 16-bit port addresses.
Operational Modes of 8255
There are two main operational modes of 8255:
• Bit set/reset mode
• Input/output mode
There are three types of the input/output mode.
• Mode 0
• Mode 1
• Mode 2
Bit Set/Reset (BSR) mode
• Any of the eight bits of port C can be set or reset using a
single output instruction. This feature reduces software
requirements in control-based applications.
• Each line of port C (PC0 - PC7) can be set/reset by
suitably loading the command word register. No effect
occurs in input output mode.
• The individual bits of port c can be set or reset by
sending the signal OUT instruction to the control register.
Control Word Register – BSR Mode
Bit Set/Reset (BSR) mode
EXAMPLE: Write programs to perform the following operations:
(i) Reset bit 7 of port C (ii) Set bit 5 of port C
Assume the address of the port A= 80H, port B = 82H, port C =
84H and CWR = 86H.
Solution 0 X X X 1 1 1 0
i. To reset bit 7 of port C, the bit pattern of the CWR will be
Assuming XXX as 111, we will have CWR = 01111110 = 7EH
MOV AL, 7EH
OUT 86 H, AL
ii. For setting the bit 5 of port C, the CWR bit pattern will be O
1111011 = 7BH the instructions for this operation are:
MOV AL, 7BH
OUT 86H, AL.
Control Word Register – I/O mode
Control Word Register – I/O Mode

1. Bit D7: This bit is used to select the IO or BSR mode.


When D7 is 0, then 8255 will work in BSR mode and
when, D7 is 1 then 8255 will work in IO mode. Hence in
:

all the IO modes, D7 is always being kept as high.

2. Bits D6 and D5: These bits are used to specify the


mode of group A. The port A can work in three different
modes, i.e. mode 0, mode 1 and mode 2, hence two bits
are required for the mode selection as shown in Figure
above.

3. Bit D4: This bit is used to specify whether port A acts as


an input port or as an output port. When this bit is 0, then
port A will act as output port otherwise input port.
Control Word Register – I/O Mode
4. Bit D3: This bit is used to specify whether port PC
(Upper) acts as an input port or as an output port. When
this bit is 1, then port PC (Upper) will act as input port
:
otherwise output port.
5. Bit D2: This bit is used to define the mode of group B.
As port B and port PC(Lower) can act only in two modes
so only one bit is sufficient to define the mode of group
B. When D2 = 0, group B ports will act in mode 0 and if
D2 =l, this group will function in mode 1.
6. Bits D1 and D0: These bits are used to specify whether
the group B ports will be in input mode or in output
mode. Again, as in case of group A port 0 is used for
output mode and port 1 for input mode.
Input / Output Mode
Mode 0 (Simple I/O Mode)
In this mode, the ports can be used for simple input/output
operations without handshaking.
If both port A and B are initialized in mode 0, the two halves of port
C can be either used together as an additional 8-bit port, or they
can be used as individual 4-bit ports.
Since the two halves of port C are independent, they may be used
such that one-half is initialized as an input port while the other half
is initialized as an output port.
The input output features in mode 0 are as follows:
• O/P are latched.
• I/P are buffered not latched.
• Port do not have handshake or interrupt capability.
Mode 0 (Simple I/O Mode)
Mode 1 (Strobe Mode / Handshake Mode)

When we wish to use port A or port B for handshake


(strobed) input or output operation, we initialize that port in
mode 1 (port A and port B can be initialized to operate in
different modes, ie, for eg., port A can operate in mode 0
and port B in mode 1). Some of the pins of port C function
as handshake lines.
For port B in this mode (irrespective of whether is acting as
an input port or output port), PC0, PC1 and PC2 pins
function as handshake lines. If port A is initialized as mode 1
input port, then, PC3, PC4 and PC5 function as handshake
signals.
Pins PC6 and PC7 are available for use as input/output lines.
Mode 1 (Strobe Mode / Handshake Mode)

The mode 1 which supports handshaking has following


features:
• Two ports i.e. port A and B can be used as 8-bit I/O port.
• Each port uses three lines of port c as handshake signal
and remaining two signals can be function as I/O port.
• Interrupt logic is supported.
• Input and Output data are latched.
Mode 1 (Strobe Mode / Handshake Mode)

8255 Handshake Input port (Mode 1)


Mode 1 (Strobe Mode / Handshake Mode)

8255 Handshake Output port (Mode 1)


Mode 2 (Bi-Directional mode)

• Only group A can be initialized in this mode.


• Port A can be used for bidirectional handshake data
transfer. This means that data can be input or output on
the same eight lines (PA0 - PA7).
• Pins PC3 - PC7 are used as handshake lines for port A.
• The remaining pins of port C (PC0 - PC2) can be used as
input/output lines if group B is initialized in mode 0.
• In this mode, the 8255 may be used to extend the system
bus to a slave microprocessor or to transfer data bytes to
and from a floppy disk controller.
Mode 2 (Bi-Directional mode)
Functions of Port C
The various functions (assignments) of port C during the different
operating modes of port A and B
Example
Interface an input port and an output port with 8086 through
8255 and write a program to read data from input port and
transfer it to the output port.
Solution Let us assume that the input port is interfaced with port
C and port B is interfaced with the display. The program is to
repeat indefinitely.
Required control word is shown in Figure 12.24 and the CWR
byte is 89H.
Example
The addresses of the ports A, B, C, and the CWR is
Even port Odd port
Port A ASH A9H
Port B AAH ABH
Port ACH ADH
C CWR AEH AFH
Program:
MOV AL, CWRBYTE ; Transfer control byte to AL
OUT AEH, AL ; Send the control byte to the CWR of even port
OUT AFH, AL ; Send the control byte to the CWR of odd port
LOOP: IN AX, ACH ; Read data from input port
OUT AAH, AL ; Send AL data to output port
JMP LOOP ; Jump to loop
Example
Find the control word of the 8255 for the following configurations:
1.All the ports of A, B, and C are output ports (mode 0).
2.PA = in, PB = out, PCL = out, and PCH = out.
Solution:
(a) 1000 0000 = 80H
(b) 1001 0000 = 90H

Configure 8255A in mode-0 with different ports in input output


mode as below:
PORT A: Input; PORT B: Output
PCU: Output; PCL: Input
Solution: The control word to programme 8255A as above will be
1 0 0 1 0 0 012 = 91H
The control word will be outputted to control word register having
add 03H.The relevant instruction will be follows:
MVI A, 91H
OUT 03H
Thank You

You might also like