16
PROGRAMMABLE PROGRAMMABLE INTERFACING INTERFACING DEVICES DEVICES Iskandar Yahya [email protected] 03-89216591 Microprocessors & Microcomputers (Intel 8085) KL3193 1

6 -Programmable Interfacing Devices-Student

Embed Size (px)

Citation preview

Page 1: 6 -Programmable Interfacing Devices-Student

PROGRAMMABPROGRAMMABLE LE INTERFACING INTERFACING DEVICESDEVICESIskandar Yahya

[email protected]

03-89216591

Microprocessors & Microcomputers (Intel 8085)KL3193

1

Page 2: 6 -Programmable Interfacing Devices-Student

INTRODUCTIONINTRODUCTIONBASIC CONCEPTS IN PROGRAMMABLE I/O DEVICES

Basic Concept in Programmable I/O Devices

Problems…... I/O device are not always ready for data transfer I/O devices operates slower than 8085 Causes data loss and redundant data

 

Requires data buffering and handshaking

  Handshaking -

2

Page 3: 6 -Programmable Interfacing Devices-Student

INTRODUCTIONINTRODUCTIONBASIC CONCEPTS IN PROGRAMMABLE I/O DEVICES

Use Programmable Interfacing Device The Device includes:

Input and Output registers (group of latches to hold data)

Tri-state buffers Capability for bidirectional data flow Handshake and interrupt signals Control Logic Chip select logic Interrupt control logic Control, Status and Data registers

  A programmable I/O device is programmed by writing

a specific word, called Control Word. This device can be expanded to include elements such as multiple I/O ports, counters, and parallel-to-serial registers.

3

Page 4: 6 -Programmable Interfacing Devices-Student

74LS245 TRANSCEIVER74LS245 TRANSCEIVER74LS245 TRANSCEIVER AS BIDIRECTIONAL BUFFER

We can use the 74LS245 Transceiver as a programmable interfacing device.

The device is enabled by G' (active low) The direction of data flow (Input or

Output) determined by DIR control signal

DIR = High, data flow from A to B. DIR = Low, data flow from B to A

DIR is hardwired, so need an extra device to make it programmable, i.e. can be programmed by writing an instruction from the MPU

4

74LS245A

B

G’DIR

Page 5: 6 -Programmable Interfacing Devices-Student

Use a control register to interface and program the transceiver

Connect D0 bit of control register to the DIR pin of transceiver (see figure below)

-

5

74LS245 TRANSCEIVER74LS245 TRANSCEIVER74LS245 TRANSCEIVER AS BIDIRECTIONAL BUFFER

A7 A6 A5 A4 A3 A2 A1

A0

(CS)’

DI7

DI0

Control Register

7A

1A

7B

1BDIR G’

D0

Enable (Enable)’

Page 6: 6 -Programmable Interfacing Devices-Student

MPU writes into the control register the same way as any other I/O port - through port address

From figure, A1-A7 used to select the chips, A0 is to differentiate between control register and transceiver

A0 low, transceiver is enabled, when A0 high, control register is enabled

MPU calls the transceiver by the address FEH, and calls the control register by the address FFH

To set transceiver as output device, control register content is 01H, and to set it as input device, register content is 00H.

Note that DI1-DI7 are the don’t care lines

6

74LS245 TRANSCEIVER74LS245 TRANSCEIVER74LS245 TRANSCEIVER AS BIDIRECTIONAL BUFFER

Page 7: 6 -Programmable Interfacing Devices-Student

Example: write instructions to initialize the above chip as an output buffer

 Instructions:

7

74LS245 TRANSCEIVER74LS245 TRANSCEIVER74LS245 TRANSCEIVER AS BIDIRECTIONAL BUFFER

; Set D0=1; D1 through D7 are don’t care lines

;Write in the control register

;Load data byte

;send data out

Page 8: 6 -Programmable Interfacing Devices-Student

We can also use a data register as a bidirectional programmable interfacing device and treat it as a normal I/O device with its own port address. But we still need to add a control register and a status register to make it fully functional and programmable with 8085.

A programmable interfacing device called the 8155 is multipurpose device that is designed to be compatible with 8085. No extra registers or other peripherals are needed for full operation i.e. can be connected directly to 8085. It has 256 bytes of R/W memory, three I/O ports and a timer.

Another devices are called 8279, 8255A, 8254 Interval Timer, 8259A Interrupt Controller, and the 8237 DMA controller.

8

74LS245 TRANSCEIVER74LS245 TRANSCEIVER74LS245 TRANSCEIVER AS BIDIRECTIONAL BUFFER

Page 9: 6 -Programmable Interfacing Devices-Student

Since MPU and I/O devices operate at different speeds, signals are exchanged between the two for efficient and correct data transfer.

These signals are called Handshake Signals. This signal is provided by programmable

devices

MPU has 2 ways of finding out if an I/O device is ready:-- 9

HANDSHAKE SIGNALHANDSHAKE SIGNAL

Page 10: 6 -Programmable Interfacing Devices-Student

Figure shows a block diagram of a programmable device in the input mode.

10

HANDSHAKE SIGNALHANDSHAKE SIGNALHANDSHAKE SIGNAL FOR DATA INPUT

Programmable

Interfacing Device

Programmable

Interfacing Device

Peripheral such

as keyboar

d

Peripheral such

as keyboar

d

System Data Bus

(RD)’

Data Lines

STB (Strobe)

IBF (Input Buffer Full)

Pin for Status Check

INTR

Page 11: 6 -Programmable Interfacing Devices-Student

Data Input With Handshake

Steps involved in data input from keyboard: Peripheral (keyboard) informs the interfacing device by

sending handshake signal STB (Strobe) The device sends feedback - "Do not send the next byte

until this one has been read". This is done by the device sending the handshake signal IBF (Input Buffer Full)

MPU checks the status until a byte is available via Pin for Status Check, and also wait if the interfacing device sends an interrupt signal indicating that it has a byte to be read.

MPU reads the byte by sending control signal (RD)'

11

HANDSHAKE SIGNALHANDSHAKE SIGNALHANDSHAKE SIGNAL FOR DATA INPUT

Page 12: 6 -Programmable Interfacing Devices-Student

Figure shows a block diagram of a programmable device in the output mode.

12

HANDSHAKE SIGNALHANDSHAKE SIGNALHANDSHAKE SIGNAL FOR DATA OUTPUT

OBF (Output Buffer Full)

ACK (Acknowledge)

Programmable

Interfacing Device

Programmable

Interfacing Device

Peripheral such

as keyboar

d

Peripheral such

as keyboar

d

System Data Bus

(WR)’

Data Lines

Pin for Status Check

INTR

Page 13: 6 -Programmable Interfacing Devices-Student

Data Output With Handshake

For this operation, we use handshake signals that have different names but with the same function. The steps involved for output to a printer are as follows:

MPU writes a byte into the output port of the programmable interfacing device by sending the control signal (WR)'

Device will inform the peripheral (printer), by sending handshake signal OBF (Output Buffer Full) indicating a byte is on the way

The peripheral acknowledges the byte by sending ACK (acknowledge) signal to the programmable interfacing device

The interfacing device interrupts the MPU to ask for next byte, or MPU can find out that a byte has been acknowledged (successfully transferred to printer) by checking the status check pin

13

HANDSHAKE SIGNALHANDSHAKE SIGNALHANDSHAKE SIGNAL FOR DATA OUTPUT

Page 14: 6 -Programmable Interfacing Devices-Student

Similarities in the handshake signals:

ACK and STB are input signals to the interfacing device and performs similar function

OBF and IBF are output signals from the interfacing device and do the same job

14

HANDSHAKE SIGNALHANDSHAKE SIGNAL

Page 15: 6 -Programmable Interfacing Devices-Student

The 8255A and the 8254, two widely used general-purpose programmable devices, can be compatible with any microprocessors. 

The 8255A The 8255A can be programmed to transfer data under

various conditions, from simple I/O to interrupt I/O. It can be used with virtually any MPU and it is flexible,

versatile and economical, yet complex. It has 24 I/O pins: Two 8-bit parallel ports (A and B)

and the remaining pins as port C. Eight pins (Bits) at port C can be grouped intwo 4-bit

ports: CUPPER (CU) and CLOWER (CL). The functions of these ports are defined by writing a control word in the control register

15

GENERAL PURPOSE PPDGENERAL PURPOSE PPDGENERAL-PURPOSE PROGRAMMABLE PERIPHERAL DEVICES

Page 16: 6 -Programmable Interfacing Devices-Student

The functions of 8255A depends on the D7 select bit. The functions are classified in two modes:

BSR (Bit Set/Reset) mode - used to reset the bits in port C

I/O mode

I/O mode is divided to another three modes: Mode 0 - All ports function as simple I/O ports Mode 1 - Handshake mode, where ports A and/or B

use bits from port C as handshake signals. Two types of I/O data transfer 'status check' and 'interrupt' can be implemented

Mode 2 - Port A can be set up for bidirectional data transfer using handshake signals from port C, and port B can be set up either in Mode 0 or Mode 1.

*Refer Figure on page 461, Gaonkar.

16

GENERAL PURPOSE PPDGENERAL PURPOSE PPDGENERAL-PURPOSE PROGRAMMABLE PERIPHERAL DEVICES