8255A Programmable: Peripheral Interface (PPI)
8255A Programmable: Peripheral Interface (PPI)
8255A Programmable: Peripheral Interface (PPI)
The peripheral devices are slower than the microprocessor. PPI makes
an inter-relation between microprocessor and peripheral devices.
Handshaking Signal
Before making the inter-relation between peripheral device and
microprocessor the PPI send some signals to microprocessor and peripheral
device to perform the process, these signals are called handshaking signal.
8255-based devices that perform handshaking support following
handshaking signals:
Read Operation
STB goes low indicates that data are loads into port latch.
IBF Becomes high (at high to low transition of STB) indicates that input latch
contains data
INTR Becomes high (at low to high transition of STB) uP goes interrupt
subroutine to read data. RD becomes low.
IBF becomes low when read complete, RD becomes high and IBF goes low.
A
I/O Mode (Cont.)
Configuring I/O Mode
I/O Mode is configured by Mode Definition Control Word
Problems
Problem1: Write a control word to configure port A as input port in mode 0 and port B
in mode 1 as output port.
Solution:
D7 D6 D5 D4 D3 D2 D1 D0
1 0 0 1 0 1 0 0
The control word is 94H.
N.B. D0 and D3 are low if port C is used as output or if unused.
Problem 2: A control word is given CW=CDH. Explain the conditions of ports of 8255A.
Solution:
D7 D6 D5 D4 D3 D2 D1 D0
1 1 0 0 1 1 0 1
Solution:
PORTA EQU 60H
PORTB EQU 61H
CONTR EQU 63H
MOV AL, 10010000B; Configure Port A as input and Port B as output.
OUT CNTRL, AL;
MAIN : IN AL, PORTA;
AND AL, 11000000B;
JPE LEADON; (JPE= Jump if parity even, p=1)
MOV AL, 00H;
OUT PORTB, AL;
JMP MAIN;
LEDON : MOV AL, 00000100B;
OUT PORTB, AL;
JMP MAIN;
Problem 7: Figure shows an 8255A interfaced with 8086 microprocessor.
Perform the following-
(a) Identify the Port Address.
(b) Identify the Mode 0 control word to configure Port A and Port C U as output
ports and Port B and Port CL as input ports.
(c) Write a program to read the DIP switches and display the reading from Port B
at Port A, and from Port CL at Port CU.
PPIA EQU 00F8H
PPIB EQU 00F9H
PPIC EQU 00FAH
PPICR EQU 00FBH
MOV AL, 83H
OUT PPICR , AL
IN AL, PPIB
OUT PPIA, AL
IN AL, PPIC
AND AL, 0FH
MOV CL, 04H MOV CL, 04H
ROL AL, CL SHL AL, CL
OUT PPIC, AL OUT PPIC, AL
HLT HLT
Problem 8:
Write a BSR control word subroutine to set bit PC7 and PC3 and reset them after
10ms. Use the previous schematic (Figure of problem 7). Also write the delay
procedure considering the processor clock at 5 MHz .
Solution:
BSR Control Word: