0% found this document useful (0 votes)
79 views24 pages

Ppi: 82C55

1. The 8254 contains three independent 16-bit counters/timers that can be programmed to operate in different modes. 2. Each counter can be programmed to count from 1 to 65535 and has a programmable control word to select the operating mode. 3. The 8254 supports various timer modes like one-shot, continuous square wave, event counter, and software/hardware triggered one-shot for applications like timing, delay generation, and pulse width modulation.

Uploaded by

abu taher
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)
79 views24 pages

Ppi: 82C55

1. The 8254 contains three independent 16-bit counters/timers that can be programmed to operate in different modes. 2. Each counter can be programmed to count from 1 to 65535 and has a programmable control word to select the operating mode. 3. The 8254 supports various timer modes like one-shot, continuous square wave, event counter, and software/hardware triggered one-shot for applications like timing, delay generation, and pulse width modulation.

Uploaded by

abu taher
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/ 24

PPI : 82C55

 The 82C55 is a popular interfacing component,


that can interface any TTL-compatible I/O device
to the microprocessor.
 It is used to interface to the keyboard and a
parallel printer port in PCs (usually as part of an
integrated chipset).
 Requires insertion of wait states if used with a
microprocessor using higher that an 8 MHz clock.
 PPI has 24 pins for I/O that are programmable in
groups of 12 pins and has three distinct modes of
operation.
 In the PC, an 82C55 or its equivalent is decoded
at I/O ports 60H-63H.
8255 Block Diagram
Pin layout of 8255
Interfacing 8255 PPI
8255 Programmable Peripheral Interface
Data bus
D[7:0]
PA[7:0]
A0
8086 A1 PB[7:0]
RD Control port
WR PC[7:0]
RESET
A7 CS
A6
A5
A4
A3
A2 A1 A0 Port
IO/M
0 0 PA
0 1 PB
1 0 PC
1 1 Control
8255 Programmable Peripheral
Interface
Programming 8255
 8255 has three operation modes: mode 0, mode 1, and mode 2
Programming 8255
 Mode 0:
— Ports A, B, and C can be individually programmed as input or output ports
— Port C is divided into two 4-bit ports which are independent from each other

 Mode 1:
— Ports A and B are programmed as input or output ports
— Port C is used for handshaking

PA[7:0] PA[7:0]
PC4 STBA PC7 OBFA
PC5 IBFA PC6 ACKA
PC3 INTRA PC3 INTRA
8255 PB[7:0] 8255 PB[7:0]
PC2 STBB PC2 OBFB
PC1 IBFB PC1 ACKB
PC0 INTRB PC0 INTRB
PC6, 7 PC4, 5
Programming 8255
 Mode 2:
— Port A is programmed to be bi-directional
— Port C is for handshaking
— Port B can be either input or output in mode 0 or mode 1

PA[7:0]
PC7 OBFA
PC6 ACKA
PC4 STBA
8255 PC5 IBFA
PC3 INTRA
PC0 In Out STBB OBFB
PC0 In Out IBFB ACKB
PC0 In Out INTRB INTRB
PB[7:0]
Mode 0 Mode 1
1. Can you design a decoder for an 8255 chip such that its base address is 40H?
2. Write the instructions that set 8255 into mode 0, port A as input, port B as output,
PC0-PC3 as input, PC4-PC7 as output ?
Timing diagram is a combination of the Mode 1 Strobed Input
and Mode 1 Strobed Output Timing diagrams.
Example: Mode 1 Input
8255 keyboard
 BIT5 EQU 20H
PA0
 PORTC EQU 22H
 PORTA EQU 20H PA7

 READ PROC NEAR


 Read: STB
PC4 DAV
• IN AL, PORTC ; read portc
• TEST AL, BIT5 ;test IBF
• JZ Read ;if IBF=0
• IN AL, PORTA ;Read Data
 READ ENDP
Example: Mode 1 output
8255 Printer

PB0

PB7

ACK Data Strobe : to tell


PC2 ACK the printer to latch the
incoming data.
PC4 DS
Generated Externally
Example: Mode 1 output
BIT1 EQU 2 ;send character to printer
PORTC EQU 62H MOV AL, AH ;get data
OUT PORTB, AL ;print
PORTB EQU 61H data
CMD EQU 63H ; send data strobe to
PRINT PROC NEAR printer
; check printer ready? MOV AL, 8 ;clear DS
IN AL, PORTC ;get OBF OUT CMD, AL
TEST AL, BIT1 ;test OBF MOV AL, 9 ;clear DS
JZ PRINT ;if OBF=0 buffer OUT CMD, AL
is full ;rising the data at the
positive edge of DS
RET
PRINT ENDP
Keyboard example 1/2
Keyboard example 2/2
Programmable Timer 8254
8254 Programming
8254 Programming

 Each counter may be programmed


with a count of 1 to FFFFH.
• Minimum count is 1 all modes except 2
and 3 with minimum count of 2.
 Each counter has a program control
word used to select the way the
counter operates.
• If two bytes are programmed, then the
first byte (LSB) stops the count, and the
second byte (MSB) starts the counter
with the new count.
8254 Read Back Command
 8254 Read Back Command

1 1 COUNT STATUS CNT2 CNT1 CNT0 0

 8254 status word format

NULL
OUTPUT COUNT RW1 RW0 M2 M1 M0 BCD

NULL COUNT: goes low when the new count written to a counter is
actually loaded into the counter
8254 Modes

 Mode 0: An events counter enabled with G.


• The output becomes a logic 0 when the control word is
written and remains there until N plus the number of
programmed counts.

Mode 1: One-shot mode.


• The G input triggers the counter to output a 0 pulse for
`count' clocks.
• Counter reloaded if G is pulsed again.
8254 Modes

 Mode 2: Counter generates a series of pulses 1 clock pulse


wide.
• The seperation between pulses is determined by the count.
• The cycle is repeated until reprogrammed or G pin set to 0.

• Mode 3: Generates a continuous square-wave with G set to 1.


 If count is even, 50% duty cycle otherwise OUT is high 1 cycle
longer.
8254 Modes

 Mode 4: Software triggered one-shot


• (G must be 1).

 Mode 5: Hardware triggered one-


shot. G controls similar to Mode 1.

You might also like