8255 Ppi
8255 Ppi
(A2 to A15 can be Don’t care; or as per interfacing scheme employed by the designer)
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.
CONT..
PB0‐PB7:Similar to PA
PC0‐PC7:This is also 8‐bit bidirectional I/O
pins. These lines are divided into two
groups.
1. PC0 to PC3(Lower Groups)
2. PC4 to PC7 (Higher groups)
PORT A:
This is a 8‐bit buffered I/O latch.
It can be programmed by mode 0 , mode 1, mode 2 .
PORT B:
This is a 8‐bit buffer I/O latch.
It can be programmed by mode 0 and mode 1.
PORT C:
This is a 8‐bit Unlatched buffer Input and an Output latch.
It is split into two parts, Port C Upper and Port C Lower.
It can be programmed by bit set/reset operation.
MODES OF OPERATION
D7 D6 D5 D4 D3 D2 D1 D0
0= BSR
1=I/O MODE
• Two modes- Bit Set Reset (BSR) mode and Input/ Output
(I/O) mode.
• It depends on the value of the D7 bit of the Control Word
Register.
BIT SET/RESET MODE
• Any one of the 8‐bits of PORT C can be Set or Reset depending upon the select bits on control
word register.
Example:
PORT C BIT
To Set PC3, control register will D3 D2 D1 #
be 0XXX0111. 0 0 0 0
To reset PC4, control register 0 0 1 1
will be 0XXX1000. 0 1 0 2
0 1 1 3
To set the 5th bit of Port C (LED)
(X is a don’t care). 00001001=09h 1 0 0 4
MVI A, 09 1 0 1 5
OUT 43H 1 1 0 6
* Here 43H is the 8-bit port 1 1 1 7
address of 8255 CWR
I/O MODE
3 types of I/O modes are there, mode0, mode1 and mode2.
A
MODE 0 (SIMPLE INPUT / OUTPUT)
In this mode , two 8 bit ports (port A and port B)
and two 4 bit ports(port C upper and port C
lower) are available for I/O operations.
Features:
Any port can be used as an input or output port.
Ports do not have Handshake or interrupt capability.
MODE 1 (STROBED I/O MODE)
▪Two groups‐group A and group B are available for
strobed data transfer.
▪Each group contains one 8‐bit data I/O port and one 4
bit control port.
▪The 8 bit data port can be either used as input or output
port.
▪Out of 8 bit port C, PC3 to PC5 are used to generate
control signals for port A and PC0 to PC2 are used to
generate control signals for port B.
▪The lines PC6 and PC7 may be used as independent I/O
lines.
MODE 2 (STROBED BI‐DIRECTIONAL
I/O MODE)
• This mode allows bidirectional data transfer
over a single 8‐bit data bus (port A) using
handshake signals.
Port A is working as 8‐bit bidirectional.
5 bit control port PC3‐PC7 is used for generating/accepting
handshaking signals of port A.
Here, port B and three lines of port C (PC2‐PC0) may be
used in either simple I/O mode or strobed mode.
PC0‐PC7 is set or reset as per the status of D0 of CWR.
HANDSHAKING SIGNALS
Handshaking signals are dedicated signals to coordinate data transfer
between two devices with different speeds. The following are the
commonly used handshaking signals:
STB (Strobe Input): This signal is generated by a peripheral device that
it has transmitted a byte of data.
IBF (Input buffer full): This signal is an acknowledgment by the 8255 to
indicate that the input latch has received the data byte.
OBF(Output Buffer Full): This is an output signal that goes low when the
microprocessor writes data into the output latch of the 8255.
ACK (Acknowledge): This is an input signal from a peripheral that must
output a low when the peripheral receives the data from the 8255
ports.
INTE: An internal flip-flop used to enable or disable the generation of
INTR.
PORT A AS INPUT PORT IN MODE 1
PORT A AS OUTPUT PORT IN MODE 1
PORT A IN MODE 2
PORT C AS CONTROL SIGNALS
CONT..
Port C pins act as handshake signals, when Port
A and Port B are configured for any mode other
than Mode 0.
(PC5-0 are handshake lines, some i/p lines and others o/p.
So they are shown as X)
CW= BC or BD
MVI A, BC
OUT 43H
EXAMPLE 3
Configure Port A in Mode 2, Port B as o/p in
mode 1. (PC5-0 are handshake lines for Port A
and PC2-0 are handshake signals for port B).
1 1 0 X X 1 0 X = C4H / C5H
EXAMPLE 4
Reset to 0 bit 6 of Port C .
0 X X X 1 1 0 0 = 0CH
1 0 0 0 0 0 0 0 80H
0 1 0 0 0 0 0 0 40H
0 0 1 0 0 0 0 0 20H
0 0 0 1 0 0 0 0 10H
0 0 0 0 1 0 0 0 08H
0 0 0 0 0 1 0 0 04H
0 0 0 0 0 0 1 0 02H
0 0 0 0 0 0 0 1 01H
ROLLING 2
P7 P6 P5 P4 P3 P2 P1 P0 8-BIT VALUE
1 0 0 0 0 0 0 0 80H
1 1 0 0 0 0 0 0 C0H
1 1 1 0 0 0 0 0 E0H
1 1 1 1 0 0 0 0 F0H
1 1 1 1 1 0 0 0 F8H
1 1 1 1 1 1 0 0 FCH
1 1 1 1 1 1 1 0 FEH
1 1 1 1 1 1 1 1 FFH
MVI A, 80 H Program
OUT 43 H
MVI A,08
START: MVI A, 80
OUT 40
OUT 40
CALL DELAY
CALL DELAY MVI A, 04
MVI A, 40; PATTERN DATA OUT 40
OUT 40 ; ADDR CALL DELAY
CALL DELAY MVI A, 02
OUT 40
MVI A, 20
MVI A, 01
OUT 40
OUT 40
CALL DELAY CALL DELAY
MVI A, 10 JMP START
OUT 40
SSD
For SSD use 7447 BCD to SSD converter
For flashing display: 9 (flash)
For rolling 0→1→…..→9
END OF LECTURE