Top Banner
Programmable Peripheral Interface Devices Support chips: 8155, 8255, 8279, 8254, DMA Controller, Interrupt Controller, USART
35
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: 8155 GPPI

Programmable Peripheral

Interface DevicesSupport chips: 8155, 8255, 8279, 8254, DMA

Controller, Interrupt Controller, USART

Page 2: 8155 GPPI

Programmable Interface

Devices Programmable Interface Device

used to interface a I/O device to the microprocessor

It is a multifunction device designed to use in minimum mode system

It contain RAM, I/O ports and Timer

8085Programmable

I/O

Interface

I/O

Devices

System Bus

Page 3: 8155 GPPI

Requirement for PPI

I/P & O/P Regs: A group of latches to

hold data

Tri-State Buffer

Capability of Bidirectional data flow

Handshake & Interrupt signal

Control Logic

Chip Select Logic

Interrupt control logic

Page 4: 8155 GPPI

8155 – A multipurpose

programmable interface

Designed to be compatible with 8085

It includes

◦ 256 bytes of Read/Write memory

◦ Three I/O ports

Port A (8-bit)

Port B (8-bit)

Port C (6-bit)

◦ A 14-bit timer

◦ Internal address latch to Demux AD0-

AD7, using ALE line

Page 5: 8155 GPPI

Block Diagram - 8155

256 X 8

Static

RAM

A

B

CTimer

8

8

6

Port A

Port B

Port C

PA0-7

PB0-7

PC0-5

8AD0-7

IO/M

CE

ALE

RD

WR

Timer CLK

TIMER OUT

Vcc (+5 V)

Vss (0 V)

RESET

I/O D

evic

es

8085

Page 6: 8155 GPPI

Application design with 8155

Objectives

◦ Interfacing 8155 with 8085

◦ Programming 8155

Page 7: 8155 GPPI

8085

Interfacing 8085 with 8155

256 X 8

Static

RAM

A

B

CTimer

8

8

6

Port A

Port B

Port C

8AD0-7

IO/M

CE

ALE

RD

WR

RESET

A15

8085 8155

Page 8: 8155 GPPI

Configurable Device Example

Latch Direction

A

B

Direction Chip

Select

Page 9: 8155 GPPI

Programming 8155

8155 is a Programmable Peripheral Interface

8085 can send data to 8155 using data bus

This data can be◦ For I/O devices connected to 8155

◦ Timer registers of 8155

◦ Instruction/Command word for 8155

Commands for 8155 are stored in a 8-bit Control Register inside 8155

Page 10: 8155 GPPI

Program

MVI A,01 H ; Set Do=1, D1-D7==0

OUTFFH ;Write in control register

MVI A,BYTE1 ;Load data bye

OUTFEH ; Send Data out

7A

0A

DIRG: Enable

7B

0BControl

Reg

D0

D1

D7A7

A6

A5

A4

A3

A2

A1

A0

Page 11: 8155 GPPI

3 to 8

Decoder

CWR

Port

A

Port

B

Port

C

TimerMSB

LSB

Latch

Clock for timer

PA0-PA7

PB0-

PB7

PC0-

PC5

Timer

Out

A0

A1

A2ALE

AD0-AD7A0-A7

D7-D0

0

1

2

3

4

5

CEb

A2 A

1

A0 Port (ALE

high,

AD0=A0)

0 0 0 Command

/Status

Register

0 0 1 PA

0 1 0 PB

0 1 1 PC

1 0 0 Timer LSB

1 0 1 Timer MSB

Page 12: 8155 GPPI

3 to 8

Decoder

04A13

A12

A11

A15

A14

A2

A1

A0

5

V

3 to 8

Decoder

RAM

Cont

rolCWR

Port

A

Port

B

Port

C

TimerMSB

LSB

Latc

h

Clock for timer

PA0-

PA7

PB0-

PB7

PC0-

PC5

Timer

Out

Reset in

RD

WR

A0

A1

A2

ALE

C

EIO/M

IO/

M

AD0-AD7

A0-

A7

D7-

D0

20H

21H

22H

23H

24H

25H

CS

Page 13: 8155 GPPI

What type of Commands can be

given to 8155?

To configure the I/O ports as Input or

Output

To start/stop timer etc.

To use handshake mode or not

Page 14: 8155 GPPI

Control word for 8155

A command/instruction for 8155 is also

called control word

This control word is written to control

register of 8155

Control word of 8155 is of 8-bits

Page 15: 8155 GPPI

Control Word Definition for

8155D0

D1

D2

D3

D4

D5

D6

D7

D3 D2 PORT C

0 0 ALT1

0 1 ALT2

1 0 ALT3

1 1 ALT4

D7 D6 Timer

0 0 NOP

0 1 Stop

1 0 Stop

after TC

1 0 Start

Port A

Port B

0, Input

1, Output

Port C

Interrupt Enable Port A

Interrupt Enable Port B

0, Disable

1, Enable

Timer

Page 16: 8155 GPPI

I/O functions of Port C

ALT D3 D2 PC5 PC4 PC3 PC2 PC1 PC0

ALT1 0 0 I I I I I I

ALT2 0 1 O O O O O O

ALT3 1 0 O O O STBA BFA INTRA

ALT4 1 1 STBB BFB INTRB STBA BFA INTRA

I = Input O = Output

STB = Strobe BF = Buffer Full INTR = Interrupt Request

Page 17: 8155 GPPI

The 8155 timer consists of two 8-bit registers.

1. 8-bit LSB and 8-bit MSB.

2. In these 16 bits, 14 bits are used for counter and two bit for

mode selection.

3. The counter is a 14 bit down counter. It can operate in 4

different modes of operation.

We can select mode using two bits M2 and M1

00(Mode 0)- Single Square Wave

01(Mode 1)- Square Wave

10(Mode 2)- Single Pulse on TC(terminal count)

11(Mode 3)- Pulse every TC

Page 18: 8155 GPPI

Mode 0: In this mode, timer gives only one cycle of

square wave, the output remains high for 1/2 count

and remain s low for 1/2 count. If count is odd it

remains high for (n+1)/2 and low for (n-1)/2. Where n

is count value. Wave width depends on two factor: one

is Input clock pulse frequency, and the other is count

loaded in counter.

Mode 1: This mode is similar to single square wave in

operation but the when counter becomes zero, the

count value is automatically reloaded. Thus it provides

continuous square wave.

Page 19: 8155 GPPI

Mode 2: This mode gives a single clock pulse as a

output of the end of the count The output is high

normally, but it becomes low for 1 clock pulse and

again it will become high and remain high.

Mode 3: This mode is similar to mode 2 but when the

counter becomes zero the count value is

automatically reloaded. Thus it provides continuous

pulses.

Page 20: 8155 GPPI

Design an interfacing circuit to read data from an A/D

converter using the 8155A in the peripheral mapped I/O.

(Example)

8085

3-to-8 Decoder

A/D

Converter

Analog

Input

Digital

InputP

o

r

t

A

AD0-AD7

O0O7

8155

P

o

r

t

C

P

o

r

t

B

SOC

OE

EOCO2

CE

E2

E1

A2

A1

A0A11

A12

A13

A14

A15

IO/M

RD

WR

RESET

ALE

LED

Display

BFA

STBA

PC5

Page 21: 8155 GPPI

Port Addresses of 8155

A2 A1 A0 Port

0 0 0 Control/Status

Register

0 0 1 Port A

0 1 0 Port B

0 1 1 Port C

1 0 0 LSB Timer

1 0 1 MSB Timer

Chip Selection

A7 A6 A5 A4 A3

0 0 0 1 0= 10H

= 11H

= 12H

= 13H

= 14H

= 15H

Page 22: 8155 GPPI

Application Programming

Logic1. Configure 8155

2. 8085 sends SOC command to ADC

3. 8085 communicates with ADC

using PortC in handshake mode

4. 8085 reads 8-bit temperature value

from port A

5. 8085 displays the temperature

value on the LED display

Page 23: 8155 GPPI

1. Configure 8155 I/O Ports

Port A as INPUT port

Port B as OUTPUT

port

Port C in ALT3 mode

ALT D3 D2 PC5 PC4 PC3 PC2 PC1 PC0

ALT3 1 0 O O O STBA BFA INTRA

SOC EOC OE

Page 24: 8155 GPPI

Control Word for configuration

D0

D1

D2

D3

D4

D5

D6

D7

D3 D2 PORT C

0 0 ALT1

0 1 ALT2

1 0 ALT3

1 1 ALT4

D7 D6 Timer

0 0 NOP

0 1 Stop

1 0 Stop

after TC

1 0 Start

Port A

Port B

0, Input

1, Output

Port C

IE Port A

IE Port B

0, Disable

1, Enable

Timer

0

1

0

1

0

0

0

0

Page 25: 8155 GPPI

Program Instructions for configuration

Data

◦ Control word : 0AH

Port Address

◦ Address of Control register : 10H

Instructions

◦ MVI A, 0AH

◦ OUT 10H

Page 26: 8155 GPPI

2. 8085 sends SOC command to

ADC

A small duration pulse on SOC input of

ADC will start conversion process

SOC input of ADC is connected to port

pin PC5 of Port C (Port address 13H)

Data

◦ Data value 20H followed by 00H ALT D3 D2 PC5 PC4 PC3 PC2 PC1 PC0

ALT3 1 0 O O O STBA BFA INTRA

SOC

1 0 0 0 0 0

Page 27: 8155 GPPI

InstructionsStart: MVI A, 20H

OUT 13H

MVI A, 00H

OUT 13H

Page 28: 8155 GPPI

3. 8085 communicates with ADC

using Port C in handshake mode

Port A used to input 8-bit data from

ADC

Port C used for handshakingALT D3 D2 PC5 PC4 PC3 PC2 PC1 PC0

ALT3 1 0 O O O STBA BFA INTRA

EOC OE

Page 29: 8155 GPPI

ADC resets EOC to LOW at end of conversion

8155 sets BF to 1 to enable ADC output latch

8085 is waiting for BF to be SET to 1 and◦ Reads port A by making RD signal active (0)

At the end of read cycle RD goes HIGH (1)

This resets BF signal to 0.

8085 waits for BF signal to be RESETand◦ starts conversion process again

Page 30: 8155 GPPI

8085 is waiting for BF

To know the status of BF signal 8085

reads status register of 8155

Status register shares same address as

control register

X Timer INTEB BFB INTRB INTEA BFA INTRA

D7 D6 D5 D4 D3 D2 D1 D0

Status Word Definition

Page 31: 8155 GPPI

Program Instructions

8085 reads status register◦ Address of status register : 10H

◦ Reads port A if BFA = 1

◦ Output temperature on port B

Status: IN 10H

ANI 02H

JZ Status

IN 11H ;Step -4 Reads temperature value

OUT 12H ; Step –5 display on

LED’s

Page 32: 8155 GPPI

8085 reads status register

◦ Address of status register : 10H

◦ Starts conversion again if BFA = 0

Again: IN 10H

ANI 02H

JNZ Again

JMP Start

Page 33: 8155 GPPI

Complete Program

MVI A, 0AH

OUT 10H

Start: MVI A, 20H

OUT 13H

MVI A, 00H

OUT 13H

Status: IN 10H

ANI 02H

JZ Status

IN 11H

OUT 12H

Again: IN 10H

ANI 02H

JNZ Again

JMP Start

Configure 8155

Start Conversion

Read Status register

Wait till BFA = 1

Read temperature value

Display on LED

Read status register

Wait till BFA = 0

Start Conversion again

Page 34: 8155 GPPI

8155

PA7

PA6

PA5

PA4

PA3

PA2

PA1

PA0

PB7

PB6

PB5

PB4

PB3

PB2

PB1

PB0

AD7

to

AD0

IO/Mb

ALE

RDb

WRb

RESET OUT

IO/Mb

ALE

RDb

WRb

RESET OUT

7 Seg

LED

Driver

7 Seg

LED

Driver

7 Seg

LED

Driver

7 Seg

LED

Driver

3 to 8

Decoder

04A13

A12

A11

A15

A14

A2

A1

A0

5V

Page 35: 8155 GPPI

Port Address◦ Control Register=20H, Port A= 21H, Port B= 22H

Control word:

Program◦ MVI A,03 ; initialize Port A &B for O/P

◦ OUT 20H

◦ MVI A, BYTE1 ; Display BYTE1 at port A

◦ OUT 21H

◦ MVI A, BYTE2 ; Display BYTE2 at port B

◦ OUT 22H

D7 D6 D5 D4 D3 D2 D1 D0

0 0 0 0 0 0 1 1

Timer Not

Applicable

Use for

Port C

Port B

Output

Port A

Output