Chapter 5
Chapter 5
Outlines
Programmable Peripheral Interface
(8255 PPI)
Pin diagram of 8255
Signals of 8085
Block diagram of 8255
Modes of Operation of 8255
1
Parallel communication interface
INTEL 8255
2
8255 PPI
3
8255 PPI
5
PIN DIAGRAM OF 8255
6
Signals of 8085
To/Fro To/Fro
m I/O
m devices
CPU
7
8255 PIO/PPI
It has 24 input/output lines which may be individually programmed.
Port A lines are identified by symbols PA0-PA7 Port B lines are identified
by symbols PB0-PB7 Port C lines are identified by PC0-PC7 , PC3-PC0
10
• RD :
o
This is the input line driven by the
microprocessor and this line should be low to
indicate read operation to 8255.
• WR :
o
This is an input line driven by the
microprocessor. A low on this line
indicates write operation.
• A1-A0 :
o
These are the address input lines and
are driven by the microprocessor. These
lines indicates the port address (one of the 3
ports) 11
Control Logic
CS signal is the master Chip Select
A0 and A1 specify one of the two I/O Ports
CS 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 8255 is not
selected
12
Block Diagram of 8255A
13
Block Diagram of 8255 (Architecture)
4. Port A, B and C
14
1. Data bus buffer
15
2. Read/Write control logic
• This unit accepts control signals ( RD, WR ) and also inputs from
address bus and issues commands to individual group of control blocks (
Group A, Group B).
17
2. Read/Write control logic
A1 and A0 (Address Pins) – These pins in conjunction with RD and WR pins
control the selection of one of the 3 ports.
18
2. Read/Write control logic
19
3. Group A and Group B controls
• These block receive control from the CPU and issues commands to their
respective ports.
20
4. Port A, B and C
Port A, Port B & Port C
•
a)Port A: This has an 8 bit latched/buffered O/P and 8 bit input latch. It can be
programmed in 3 modes –mode 0, mode 1, mode 2.
c)Port C: This port can be divided into two 4 bit ports and can be used as control
signals for port A and port B. It can be programmed in mode 0
21
Modes of Operation of 8255
23
24
Modes of Operation of 8255
25
1.BSR Mode
SET (S): D0
NB: Don’t Cares are can be set as Zero or =1
One Reset (R): D0
=0
26
Bit/pin of port C
B3 B2 B1
selected
0 0 0 PC0
0 0 1 PC1
0 1 0 PC2
0 1 1 PC3
1 0 0 PC4
1 0 1 PC5
1 1 0 PC6
1 1 1 PC7
SET (S): D0
=1
Reset (R): D0
NB: Don’t Cares can be set as Zero or One, but in my solution all the = 0
don’t cares are set as zero. So we can have another solutions in
addition to the solutions specified here
29
Modes of Operation of 8255
1. Bit Set/Reset(BSR)
Mode
Delay is a predefined procedure to
introduce a time delay between
the off and on blinking states of
the bit
30
Modes of Operation of 8255
2. I/O Mode
• If bit 7 of a Control Word is a logical 1 then 8255 is
will be configured as a programmable I/O mode.
• The IO mode is further divided in to three modes
o Mode 0 (Simple input/output, without Handshaking)
o Mode 1 (Handshake mode)
o Mode 2 (Bidirectional Data Transfer)
• The making of inter relation between slower peripheral
device and microprocessor is called handshaking.
31
8255 Control register format for IO Mode
32
2. I/O MODE
a) Mode 0 (Simple Input or Output):
• Ports A and B are used as Simple I/O Ports, without
handshaking.
• Port C as two 4-bit ports
• Features
– Outputs are latched
– Inputs are not latched
– Ports do not have handshake or interrupt capability
33
34
b) Mode 1: (Input or Output with
Handshake)
• Handshake signals are exchanged between MPU & Peripherals
• Features
– Ports A and B are used as Simple I/O Ports
– Each port uses 3 lines from Port C as handshake
signals
– Input & Output data are latched
– interrupt logic supported
35
c) Mode 2: Bidirectional Data Transfer
37
8255A Programmable Peripheral Interface (PPI)
38
Mode 1 Strobed Input
39
Mode 1 Strobed output
40
Mode 1 – Input for PortA, PortB
41
Mode 1 – output for PortA, PortB
42
Mode 1 – Input for PortA
43
Mode 1 – Input for PortA
44
Exercise
45
Find control word
(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
46
Port A: Output, Port B: Output,
Port CU: Output, Port CL: Output
Solution:
1 0 0 0 0 0 0 0
= 80H
Solution:
1 0 0 1 1 0 1 1 = 9BH
The binary pattern is 10000010 (82H) refer to the table of control word
D2 = 0 mode 0 operation for both Port B and the lower 4 bits of Port C
D6D5 = 00 mode 0 operation for both Port A and the upper part Of Port C
D7 =1 mode enable
49
Exercise
• If control register is at Port 20H, How to configure the 8255 in Port
A Mode 0 input and Port B and C mode 0 output ?
• Identify the control pattern 10010000 (90H), Move this to the port
50
Exercise
Find the control word if PA = out, PB = in, PC0- PC3 = in, and PC4 - PC7
= out.
1 0 0 0 0 0 1 1 = 83H
51
Exercise
Write a program to configure port A as input, B as output
and all the bits of port C as output. Assuming a base address
of 50h. Find the control word.
NB: if base address is give address of the other port is
simple to calculate. b/c base address is address of port A.
then the address increment sequentially.
52
8255 Decoding
If Port A is 1238H and Port B is 123AH, Can you identify which Two address
lines are Connected to A1A0?
53
8255 Decoding
If PortA occupies location 1238H and PortB occupies 123AH, can you
determine addresses occupied by other Ports? What address lines are
connected to A1A0 of the 8255?
54
Exercise
Example: The 8255 shown in Figure 11-13 is configured as follows: port A
as input, B as output, and all the bits of port C as output. (you are expected
to use the Address decoding concepts from part I of Chapter 6 )
55
NB: Address lines, A2 – A9 from the decoder , are
(a) Find the port addresses assigned to A, B, C, and the control register.
56
Exercise
(b) Find the control byte (word) for this configuration. Port A as input, B as
output, and all the bits of port C as output. Solution:
57
Exercise
58
Exercise
59
Exercise
60
Exercise
Address
Decoder
61
Exercise
62
Exercise
Address Decoder
63
Exercise
NB: Address lines, A2 – A7,are decoded to be
input of CS
64
Exercise
65
Exercise
300H is Address of PORT A
Value of AL is 83H is Value of Control Word
Rotated to left 4
times; Lower Configuring the Control Word Register by
nibbles (PC0 – sending out the control word onto the address
PC7) are copied 3003 H (= 300H +3) which is address of the
into their Control word Register
respective
higher nibbles Reading from PRTB (with Address 300H + 1 = 300H)
(PC4- PC7) and into Register AL, and sending out ( Writing) the
all lower nibbles Value in Register AL onto port address 300H
become 0. (Which is Address of PORT A)
Read from the address D8255 + 2 (= 300H + 2 =
302H which is Address of PORT C) into AL register
The way to Making PC4-PC7 all 0’s, and PC0 – PC3 remain
send a data unmodified as they have been before
read from
Clower (PCL) sending out (Writing) the value in AL register
into Cupper onto the Port Address D8255 +2 (= 300H + 2 =
(PCU) 302H, which address of PORT C).
66
Exercise
67
Exercise
68
Thank
U!
69