Download Basic Input and Output Interface - Microprocessors and Computer Systems - Lecture Slides and more Slides Microprocessors in PDF only on Docsity!
Basic Input & Output Interface
Outline
a
Input-output Interface
a
Serial/Parallel Interface
a
8255 Programmable Peripheral Interface
a
Keyboard
a
8254 Software-ProgrammableTimer/Counter
I/O interface
a
Input-output involves the transfer to (or from) peripheral devicesfrom (or to) the data bus of the cpu; eg. data transfer to the CRTdisplay, from the keyboard, to/from a hard-disk drive, to/from amodem to another computer system.
a
Input-output operations fall into one of the following types: •^ Programmed I/O
- cpu polls peripherals to check if I/O is needed -^
Interrupt I/O
- peripheral sends an interrupt request to cpu for I/O -^
Direct memory access (DMA)
- peripheral writes directly to memory
a
Considering the address of I/O, 8088 uses Isolated I/O (I/Oaddresses are not part of memory address) as distinct fromMemory mapped I/O (peripherals are mapped to locations in thememory address space).
Q: pros and cons of isolated I/O and memory mapped I/O?
1M
×
Memory
FFFFF^00000
FFFF
64K
×
I/O
(a) Memory + I/O
I/O
FFFFF^00000
(b)
The Memory and I/Omaps for the 8086/8088microprocessor.(a) Isolated I/O.(b) Memory mapped I/O.
Memory and I/O Map
Q: In Isolated I/O, an I/O port has thesame address as one of the memorybyte. How does it know it is beingaddressed?
I/O interface
a
I/O interface functions include •^
data storage buffer for sending and receiving data
-^
low-level communications protocol (handshaking)
-^
data format conversion (eg. parallel/serial)
-^
error detection
-^
addressing of different peripherals
a
I/O interface are typically implemented by LSI (large scaleintegration) - many different types are available from differentmanufacturers.
a
Data can be transferred through I/O interface by eitherprogrammed I/O or interrupt I/O. DMA typically needs a separatecontroller.
8088 maximum mode I/O interface
AIOWC
Bus controller
I/O
interfacecircuitry
I/O device
I/O device
N-
I/O device
A^8
-A
19
AD
-AD 0
7
S^0
-S
2 CLK
ALE DEN
Generalized I/O interface connections to maximum mode 8088
IORCIOWC
R
DT/
M
IO/
Parallel and Serial Data Transfer
(cont.)
a
Serial data transfer involves sending the data on a single line, bitby bit. The I/O interface converts the data from parallel to serial orvice-versa using shift registers.
a
Serial connections are commonly used for data transfer overlonger distances (eg over telephone line). A popular standard forserial data transmission is the RS232C standard.Q: Why serial data transfer is more commonly used in long distance transmission?
Serial I/O
a
Serial I/O can be either(1) Synchronous - data are sent in blocks, with
start
and
end-of-block
markers.
Individual characters within a block do not need start and stop
bits since the receiver identifies every 8 bits as one character, eg.
syn
syn
stx
data field
etx
bcc
pad
one frame
syn = sync character (ascii code 16)stx = start of text (ascii code 02)etx = end of text (ascii code 03)bcc = block check characters (error detection)pad = end of frame pad ( ascii code ff)
Handshaking for I/O
a
Three types of handshaking: •^ Simple parallel I/O - no handshaking implemented •^ Single handshake I/O - uses STB-ACK handshake •^ Double handshake I/O - uses STB-ACK and STB-ACK
data
simple (no handshake)
Handshaking for I/O (cont.)
data
DoubleHandshake
strobeACK
Data transferred after thefirst STB and ACK.
Tx Rx
data
SingleHandshake
strobeACK
: means the circle will trigger theevent pointed by the arrow aftera given time
8255A Programmable Parallel
Port Device
Internal structureblock diagram
GROUP APRRT CUPPERGROUP BPRRT CLOWER GROU BPORT B
(8)
8 BITSINTERNALDATA BUS
Bi-directionalData BusD0-D
DATABUSBUFFER
RDWRA1A RESET
CS
READ/WRITECONTROLLOGIC
PowerSupply
+5VGND
GROUPACONTROL GROUP B CONTROL
GROUP APORTA
(8)
I/O PA7-PA
I/O PC7-PC I/O PC3-PC I/O PB7-PB
8255A Mode 0 Operation
a
In Mode 0 operation, no handshaking will be used.
a
If both port A and port B are initialized as mode 0 operation, port Ccan be used together as an additional 8-bit port, or two 4-bit ports.
a
When used as an outputs, port C line can be set/reset by sendingspecial control word to the
control register address.
a
The two halves of port C are independent and can be set as inputor output port independently.
8255A Mode 1 Operation
a
In Mode 1 operation, single handshaking (strobed) is used.
a
In this mode, some of the port C pins are used for handshakingpurpose.
`
If Port A is set to mode 1 & input port:
PC3, PC4, and PC5 pins are used.
`
If Port A is set to mode 1 & output port: PC3, PC6, and PC7 pins are used.
`
If Port B is set to mode 1 & input port:
PC0, PC1, and PC2 pins are used.
`
If Port B is set to mode 1 & output port: PC0, PC1, and PC2 pins are used.
8255A Mode 1 Operation
MODE 1
PB7-PB
PA7-PA
I/O
I/O
B^8
A
PC
PC
PC
PC
PC
PC
PC
PC
I/O
I/O
A
ACK
OR
OR
I/O
OR I/O
OR
OR
OR
INTR
B^
INTR
A
B
OBF
A
OBF
B
ACK
IBF
B^
IBF
A
PORT A, PORT B CONTROL
INPUT HANDSHAKING
SIGNAL
OUTPUT HANDSHAKING
SIGNAL
INTR
B^
INTR
A
STB
B^
A STB