Você está na página 1de 16

Microprocessors & Microcomputers (Intel 8085)

KL3193

PROGRAMMABL
E INTERFACING
DEVICES
1 Iskandar Yahya
iskandar@vlsi.eng.ukm.my
03-89216591
INTRODUCTION
BASIC 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
INTRODUCTION
BASIC 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 3
be expanded to include elements such as multiple I/O
ports, counters, and parallel-to-serial registers.
74LS245 TRANSCEIVER
74LS245 TRANSCEIVER AS BIDIRECTIONAL BUFFER

 We can use the 74LS245 Transceiver as a


programmable interfacing device. 74LS245
 The device is enabled by G' (active low) A

 The direction of data flow (Input or B

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 DIR G’
be programmed by writing an instruction
from the MPU

4
74LS245 TRANSCEIVER
74LS245 TRANSCEIVER AS BIDIRECTIONAL BUFFER

 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)
 -
(CS)’

DI7 Control 7A 7B
A7 Register
A6
A5
A4 1A 1B
A3 DI0 D0 DIR
A2 G’
A1
Enable (Enable)’

A0 5
74LS245 TRANSCEIVER
74LS245 TRANSCEIVER AS BIDIRECTIONAL BUFFER

 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 TRANSCEIVER
74LS245 TRANSCEIVER AS BIDIRECTIONAL BUFFER

Example: write instructions to initialize


the above chip as an output buffer
 
Instructions:
; Set D0=1; D1 through D7 are don’t care
lines
;Write in the control register

;Load data byte

;send data out

7
74LS245 TRANSCEIVER
74LS245 TRANSCEIVER AS BIDIRECTIONAL BUFFER

 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.
8
 Another devices are called 8279, 8255A, 8254 Interval
Timer, 8259A Interrupt Controller, and the 8237 DMA
HANDSHAKE SIGNAL

 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 SIGNAL
HANDSHAKE SIGNAL FOR DATA INPUT

System Data Lines


Data Bus Peripher
Programma STB (Strobe) al such
ble
Interfacing IBF (Input as
Device Buffer Full) keyboar
(RD)’ Pin for Status
d
Check

INTR

 Figure shows a block diagram of a programmable device in the


input mode.

10
HANDSHAKE SIGNAL
HANDSHAKE SIGNAL FOR DATA INPUT

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 SIGNAL
HANDSHAKE SIGNAL FOR DATA OUTPUT

System Data Lines


Data Bus Peripher
Programma OBF (Output al such
Buffer Full)
ble
Interfacing ACK
as
Device (Acknowledge) keyboar
(WR)’ Pin for Status
d
Check

INTR

 Figure shows a block diagram of a programmable device in the


output mode.

12
HANDSHAKE SIGNAL
HANDSHAKE SIGNAL FOR DATA OUTPUT

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 13
acknowledged (successfully transferred to printer) by
checking the status check pin
HANDSHAKE SIGNAL

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
GENERAL PURPOSE PPD
GENERAL-PURPOSE PROGRAMMABLE PERIPHERAL DEVICES

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 15

control register
GENERAL PURPOSE PPD
GENERAL-PURPOSE PROGRAMMABLE PERIPHERAL DEVICES

 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
16
data transfer using handshake signals from port C,
and port B can be set up either in Mode 0 or Mode
1.

Você também pode gostar