25
Programmable Peripheral Interface Devices Support chips: 8155, 8255, 8279, 8254, DMA Controller, Interrupt Controller, USART

1203 Ppi 8155

  • Upload
    techbed

  • View
    8.137

  • Download
    14

Embed Size (px)

DESCRIPTION

ppi 8155 interfacingvisit: www.techbed.blogspot.com

Citation preview

Page 1: 1203 Ppi 8155

Programmable Peripheral Interface Devices

Support chips: 8155, 8255, 8279, 8254, DMA Controller, Interrupt Controller,

USART

Page 2: 1203 Ppi 8155

Programmable Interface Devices

used to interface a I/O device to the microprocessor

8085Programmable

I/O Interface

I/O Devices

System Bus

Page 3: 1203 Ppi 8155

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 Port B Port C

A 14-bit timer

Page 4: 1203 Ppi 8155

Block Diagram - 8155

256 X 8StaticRAM

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

evices

8085

Page 5: 1203 Ppi 8155

Application design with 8155

Objectives Interfacing 8155 with 8085 Programming 8155

Page 6: 1203 Ppi 8155

8085

Interfacing 8085 with 8155

256 X 8StaticRAM

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 7: 1203 Ppi 8155

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 8: 1203 Ppi 8155

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 9: 1203 Ppi 8155

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 10: 1203 Ppi 8155

Control Word Definition for 8155

D0

D1

D2

D3

D4

D5

D6

D7

D3 D2 PORT C

0 0 ALT1

0 1 ALT2

1 0 ALT3

1 1 ALT4

Port A

Port B

0, Input

1, Output

Port C

Interrupt Enable Port A

Interrupt Enable Port B

0, Disable

1, Enable

Timer

D7 D6 Timer

0 0 NOP

0 1 Stop

1 0 Stop after TC

1 0 Start

Page 11: 1203 Ppi 8155

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 12: 1203 Ppi 8155

Design an interfacing circuit to read data from an A/D converter using the 8155A in the peripheral mapped I/O.

8085

3-to-8 Decoder

A/DConverter

AnalogInput

Digital InputP

or t A

AD0-AD7

O0O7

8155

Por t C

Por t B

SOC

OE

EOCO2

CE

E2

E1

A2

A1

A0A11

A12

A13

A14

A15

IO/M

RDWR

RESET

ALE

LEDDisplay

BFA

STBA

PC5

Page 13: 1203 Ppi 8155

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 14: 1203 Ppi 8155

Application Programming Logic

1. 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 15: 1203 Ppi 8155

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 16: 1203 Ppi 8155

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

Port A

Port B

0, Input

1, Output

Port C

IE Port A

IE Port B

0, Disable

1, Enable

Timer

D7 D6 Timer

0 0 NOP

0 1 Stop

1 0 Stop

after TC

1 0 Start

0

1

0

1

0

0

0

0

Page 17: 1203 Ppi 8155

Program Instructions for configuration

Data Control word : 0AH

Port Address Address of Control register : 10H

Instructions MVI A, 0AH OUT 10H

Page 18: 1203 Ppi 8155

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 19: 1203 Ppi 8155

InstructionsStart: MVI A, 20H

OUT 13H

MVI A, 00H

OUT 13H

Page 20: 1203 Ppi 8155

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 handshaking

ALT D3 D2 PC5 PC4 PC3 PC2 PC1 PC0

ALT3 1 0 O O O STBA BFA INTRA

EOC OE

Page 21: 1203 Ppi 8155

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 RESET and

starts conversion process again

Page 22: 1203 Ppi 8155

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 23: 1203 Ppi 8155

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 24: 1203 Ppi 8155

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 25: 1203 Ppi 8155

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