1 of 26

​

​

BRANCH-E & TC ENGG

SUBJECT-MICROPROCESSOR & MICROCONTROLLER

CHAPTER-4-MICROPROCESSOR BASED SYSTEM DEVELOPMENT AID

TOPIC-8255 PROGRAMMABLE PERIPHERAL INTERFACE

SEM-4TH

FACULTY-ER. ARADHANA DAS(LECT. E & TC ENGG DEPARTMENT)

AY-2021-2022, SUMMER-2022

​

PROGRAMMABLE PERIPHERAL INTERFACE

2 of 26

8255 PPI

  • PPI

Programmable Peripheral Interface

2

3 of 26

Intel 8255 PPI

PPI – Programmable Peripheral Interface

​

It is an I/O port chip used for interfacing I/O devices with microprocessor

​

Very commonly used peripheral chip

​

Knowledge of 8255 essential for students in the Microprocessors lab for Interfacing experiments

​

3

4 of 26

About 82C55

  • The 82C55 is a popular interfacing component, that can interface any TTL-compatible I/O device to a 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.

5 of 26

82C55 : Pin Layout

6 of 26

8255 Control Word

7 of 26

Basic Mode Definitions and Bus Int

​

​

​

​

  • Mode 0
    • Basic I/O
  • Mode 1
    • Strobe I/O
  • Mode 2
    • Bi-Dir Bus

8 of 26

11-8

Programming 8255

  • 8255 has three operation modes: mode 0, mode 1, and mode 2

9 of 26

9

10 of 26

8255 PPI contd.

3 ports in 8255 from user’s point of view

- Port A, Port B and Port C.

Port C composed of two independent 4-bit ports - PC7-4 (PC Upper) and PC3-0 (PC Lower)

A1

A0

Selected port

0

0

Port A

0

1

Port B

1

0

Port C

1

1

Control port

10

11 of 26

Intel 8255 PPI

A7

M/IO*

Chip Select Circuit

11

A7=0, A6=1, A5=1, A4=1, A3=1, A2=1, & M/IO*= 0

12 of 26

8255 PPI Contd.

There is also a Control port from the Processor point of view. Its contents decides the working of 8255.

​

When CS (Chip select) is 0, 8255 is selected for communication by the processor. The chip select circuit connected to the CS pin assigns addresses to the ports of 8255.

​

For the chip select circuit shown, the chip is selected when A7=0, A6=1, A5=1, A4=1, A3=1, A2=1, & M/IO*= 0

​

Port A, Port B, Port C and Control port will have the addresses as 7CH, 7DH, 7EH, and 7FH respectively.

12

13 of 26

8255 PPI Contd.

13

Mode 0: Simple Input or Output

​

In this mode, ports A, B are used as two simple 8-bit I/O ports

port C as two 4-bit ports.

Each port can be programmed to function as simply an input port or an output port. The input/output features in Mode 0 are as follows.

�1. Outputs are latched.��2. Inputs are not latched.��3. Ports don’t have handshake or interrupt capability.�

14 of 26

8255 PPI Contd.

14

Mode 1: Input or Output with Handshake �  �In this mode, handshake signals are exchanged between

the MPU and peripherals prior to data transfer.

The features of the mode include the following: ���1. Two ports (A and B) function as 8-bit I/O ports.

They can be configured as either as input or output ports.��2. Each port uses three lines from ort C as handshake signals.

The remaining two lines of Port C can be used for simple I/O operations.��3. Input and Output data are latched.��4. Interrupt logic is supported.

15 of 26

8255 PPI Contd.

15

Mode 2: Bidirectional Data Transfer ��This mode is used primarily in applications such as data transfer

between two computers.

​

In this mode, Port A can be configured as the bidirectional port

Port B either in Mode 0 or Mode 1.

​

Port A uses five signals from Port C

as handshake signals for data transfer.

​

The remaining three signals from port C can be used either

as simple I/O or as handshake for port B.�

​

16 of 26

8255 Handshake signals

Where are the Handshake signals?

​

Port C pins act as handshake signals, when Port A and Port B are configured for other than Mode 0.

​

Port A in Mode 2 and Port B in Mode 1 is possible, as it needs only 5+3 = 8 handshake signals

​

After Reset of 8255, Port A , Port B , and Port C are configured for Mode 0 operation as input ports.

16

17 of 26

8255 Handshake signals Contd.

PC2-0 are used as handshake signals by Port B

when configured in Mode 1. This is immaterial whether Port B is configured as i/p or o/p port.

​

PC5-3 are used as handshake signals by Port A when configured as i/p port in Mode 1.

​

PC7,6,3 are used as handshake signals by Port A when configured as o/p port in Mode 1.

​

PC7-3 are used as handshake signals by Port A when configured in Mode 2.

17

18 of 26

8255 PPI Contd.

Port A can work in Mode 0, Mode 1, or Mode 2

Port B can work in Mode 0, or Mode 1

Port C can work in Mode 0 only, if at all

​

​

Port A, Port B and Port C can work in Mode 0

Port A and Port B can work in Mode 1

Only Port A can work in Mode 2

18

19 of 26

8255 MD Control word

Control port having Mode Definition (MD) control word

1

M2A

M1A

I/P A

I/P CU

M1B

I/P B

I/P CL

Means Mode Definition control word

​

1 - PCU as input

0 - PCU as output

1 - PA as input

0 - PA as output

​

1 -PCL as input

0 -PCL as output

1 - PB as input

0 - PB as output

1 – Port B in Mode 1

0 – Port B in Mode 0

M2A M1A

​

0 0

Port A in Mode 0

​

0 1

Port A in Mode 1

​

1 0/1

Port A in Mode 2

​

​

​

​

19

20 of 26

8255 MD Control word Contd.

Ex. 1: Configure Port A as i/p in Mode 0, Port B as o/p in mode 0, Port C (Lower) as o/p and Port C (Upper) as i/p ports.

Required MD control word:

​

​

​

​

​

​

​

1

0

0

1

1

0

0

0

=

98H

MD control

​

​

​

​

​

​

PC Lower as o/p

​

PA in Mode 0

​

​

​

PB as o/p Reqd. instrns.

​

​

PA as i/p

​

PB in Mode 0

MOV AL, 98H

​

​

​

​

​

​

PC Upper as i/p

OUT 7FH, AL

20

21 of 26

8255 MD Control word Contd.

Ex. 2: Configure Port A as i/p in Mode 1, Port B as o/p in mode 1, Port C7-8 as i/p ports. (PC5-0 are handshake lines, some i/p lines and others o/p. So they are shown as X)

Required MD control word:

​

​

​

​

​

​

​

1

0

1

1

1

1

0

X

=

BCH or BDH

MD control

​

​

​

​

​

​

PC3-0 as don’t care

​

PA in Mode 1

​

​

​

PB as o/p Reqd. Instrns.

​

​

PA as i/p

​

PB in Mode 1

MOV AL,BCH

​

​

​

​

​

PC Upper(C7-8) as i/p

OUT 7FH, AL

21

22 of 26

8255 PCBSR Control word contd.

Ex. 2: Reset to 0 bit 6 of Port C

​

​

0

X

X

X

1

1

0

0

=

0CH,…

PC bit set / reset control word

​

​

​

Bit 6 of PC

Reset to 0

Don’t cares

​

​

​

Required instructions

​

​

​

​

​

​

MOV AL, 0CH

​

​

​

​

​

​

​

​

​

OUT 7FH, AL

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

22

23 of 26

8255 PCBSR Control word contd.

Ex. 1: Set to 1 bit 4 of Port C

​

​

0

X

X

X

1

0

0

1

=

09H,…

PC bit set / reset control word

​

​

​

Bit 4 of PC

Set to 1

Don’t cares

​

​

​

Required instructions

​

​

​

​

​

​

MOV AL, 09H

​

​

​

​

​

​

​

​

​

OUT 7FH, AL

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

​

23

24 of 26

INTERFACING WITH STEPPER MOTOR

ROTATION PER SEQUENCE = 360/NT

NT= NUM.OF TURNS

​

​

FOUR PATTERN SWITCHING SEQUENCE

W4

W3

W2

W1

0

0

1

1

1

0

0

1

1

1

0

0

0

1

1

0

0

0

1

1

CLOCK WIS

ANTI-CLOCK

24

25 of 26

Stepper motor interface Diagram

25

26 of 26