Professional Documents
Culture Documents
Introduction
This chapter outlines some of the basic
methods of communications, both serial and
parallel, between humans or machines and
the microprocessor.
We first introduce the basic I/O interface and
discuss decoding for I/O devices.
Then, we provide detail on parallel and serial
interfacing, both of which have a variety of
applications.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
Chapter Objectives
Upon completion of this chapter, you will be able to:
Chapter Objectives
(cont.)
Chapter Objectives
(cont.)
Isolated I/O
The most common I/O transfer technique
used in the Intel-based system is isolated I/O.
isolated describes how I/O locations are isolated
from memory in a separate I/O address space
Figure 111 The memory and I/O maps for the 8086/8088 microprocessors. (a)
Isolated I/O. (b) Memory-mapped I/O.
Memory-Mapped I/O
Memory-mapped I/O does not use the IN, INS,
OUT, or OUTS instructions.
It uses any instruction that transfers data between
the microprocessor and memory.
treated as a memory location in memory map
Figure 113 The basic input interface illustrating the connection of eight
switches. Note that the 74ALS244 is a three-state buffer that controls the
application of the switch data to the data bus.
Handshaking
Many I/O devices accept or release information
slower than the microprocessor.
A method of I/O control called handshaking or
polling, synchronizes the I/O device with the
microprocessor.
An example is a parallel printer that prints a few
hundred characters per second (CPS).
The processor can send data much faster.
a way to slow the microprocessor down to match
speeds with the printer must be developed
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
Input Devices
Input devices are already TTL and compatible, and
can be connected to the microprocessor and its
interfacing components.
or they are switch-based
Output Devices
Output devices are more diverse than input
devices, but many are interfaced in a uniform
manner.
Before an output device can be interfaced, we
must understand voltages and currents from the
microprocessor or TTL interface.
Voltages are TTL-compatible from the
microprocessor of the interfacing element.
logic 0 = 0.0 V to 0.4 V
logic 1 = 2.4 V to 5.0 V
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
Figure 1110 A port decoder that decodes 8-bit I/O ports. This
decoder generates active low outputs for ports F0HF7H.
Figure 1113 The I/O banks found in the 8086, 80186, 80286,
and 80386SX.
Figure 1114 An I/O port decoder that selects ports 40H and
41H for output data.
Fig 1116 shows a 32-bit input port for 80386DX 80486DX microprocessor.
The circuit uses a single PLD to decode the I/O
ports and four 74HCT244 buffers to connect the I/O
data to the data bus.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
Figure 1120 The command byte of the command register in the 82C55. (a)
Programs ports A, B, and C. (b) Sets or resets the bit indicated in the select a
bit field.
Mode 0 Operation
Mode 0 operation causes 82C55 to function:
as a buffered input device
as a latched output device
Figure 1121 An 8-digit LED display interfaced to the 8088 microprocessor through
an 82C55 PIA.
IBF
Input buffer full is an output indicating that
the input latch contains information.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
INTR
Interrupt request is an output that requests an interrupt. The
INTR pin becomes a logic 1 when STB returns to a logic 1.
Cleared when data are input from the port by the processor.
INTE
Interrupt enable signal is neither input nor
output; it is an internal bit programmed via
port PC4 (port A) or PC2 (port B) bit position.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
PC7, PC6
The port C pins 7 and 6 are general-purpose
I/O pins that are available for any purpose.
ACK
The acknowledge signal causes the OBF
pin to return to logic 1. The ACK signal is a response from an external
device, indicating that it has received data from the 82C55 port.
INTR
Interrupt request often interrupts the
processor when the external device receives
the data via the ACK signal. Qualified by the
internal INTE (interrupt enable) bit.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
INTE
Interrupt enable is neither input nor output;
it is an internal bit programmed to enable or disable the INTR pin. INTE A
is programmed using PC6 bit. INTE B is programmed using the PC2 bit.
PC4, PC5
Port C pins PC4 and PC5 are general-purpose
I/O pins. The bit set and reset command is
used to set or reset these two pins.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
OBF
Output buffer full is an output indicating
the output buffer contains data for the
bidirectional bus.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
ACK
Acknowledge is an input that enables the three-state buffers so that data can appear
on port A. If ACK is logic 1, the output buffers of port A are at their high-impedance
state.
STB
The strobe input loads the port A input latch
with external data from the bidirectional
port A bus.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
IBF
Input buffer full is an output used to signal that the input
buffer contains data for the external bidirectional bus.
INTE
Interrupt enable are internal bits (INTE1 &
INTE2) that enable the INTR pin. The state
of the INTR pin is controlled through port C
bits PC6 (INTE1) and PC4 (INTE2).
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
CLK
The clock input is the timing source for each of the internal
counters. This input is often connected to the PCLK signal
from the microprocessor system bus controller.
CS
Chip select enables 8254 for programming
and reading or writing a counter.
G
The gate input controls the operation of the
counter in some modes of operation
GND
Ground connects to the system ground bus.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
OUT
A counter output is where the waveform
generated by the timer is available.
RD
Read causes data to be read from the 8254
and often connects to the IORC signal.
Vcc
Power connects to the +5.0 V power supply.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
WR
Write causes data to be written to the 8254
and often connects to write strobe IOWC.
Modes of Operation
six modes (05) of
available to each of
the 8254 counters
each mode functions
with the CLK input,
the gate (G) control
signal, and OUT
signal
Figure 1135 The six modes of operation for the 8254-2 programmable interval timer.
The G input stops the count when 0 in modes 2, 3, and 4.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
Mode 0
Allows 8254 to be used as an event counter.
Output becomes logic 0 when the control
word is written and remains until N plus the
number of programmed counts.
Note that gate (G) input must be logic 1 to
allow the counter to count.
If G becomes logic 0 in the middle of the
count, the counter will stop until G again
becomes logic 1.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
Mode 1
Causes function as a retriggerable, monostable
multivibrator (one-shot).
G input triggers the counter so it develops a pulse
at the OUT connection that becomes logic 0 for
the duration of the count.
if the count is 10, the OUT connection goes
low for 10 clocking periods when triggered
Mode 2
Allows the counter to generate a series of
continuous pulses one clock pulse wide.
pulse separation is determined by the count
Mode 3
Generates a continuous square wave at the
OUT connection, provided the G pin is logic 1.
If the count is even, output is high for one half
of the count and low for one half of the count.
If the count is odd, output is high for one
clocking period longer than it is low.
if the counter is programmed for a count of 5,
the output is high for three clocks and low for
two clocks
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
Mode 4
Allows a single pulse at the output.
If count is programmed as 10, output is high for 10
clocking periods and low for one period.
the cycle does not begin until the counter
is loaded with its complete count
Mode 5
A hardware triggered one-shot that functions
as mode 4.
except it is started by a trigger pulse on the
G pin instead of by software
Figure 1136 The 8254 interfaced to an 8 MHz 8086 so that it generates a 100 KHz
square wave at OUT0 and a 200 KHz continuous pulse at OUT1.
Reading a Counter
Each counter has an internal latch read with
the read counter port operation.
the latches will normally follow the count
Figure 1140 Motor speed and direction control using the 8254 timer.
Figure 1141 Timing for the motor speed and direction control circuit of Figure 1140.
(a) No rotation, (b) high-speed rotation in the reverse direction, and (c) high-speed
rotation in the forward direction.
ADS
The address strobe input is used to latch
the address lines and chip select lines.
If not needed (as in the Intel system),
connect this pin to ground.
The ADS pin is designed for use with
Motorola microprocessors.
BAUDOUT
The baud out pin is where the clock signal generated by the baud rate generator from
the transmitter section is made available.
It is most often connected to the RCLK input to generate a receiver clock that is equal to the
transmitter clock.
CTS
The clear-to-send (if low) indicates that the
modem or data set is ready to exchange
information.
This pin is often used in a half-duplex system
to turn the line around.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
D0D7
The data bus pins are connected to the
microprocessor data bus.
DCD
Data carrier detect input is used by the
modem to signal the 16550 that a carrier
is present.
DTR
Data terminal ready is an output that indicates that the data
terminal (16550)
is ready to function.
INTR
Interrupt request is an output to the
microprocessor used to request an interrupt
(INTR=1) when the 16550 has a receiver
error, it has received data, and the
transmitter is empty.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
DDIS
The disable driver output becomes logic 0
to indicate the microprocessor is reading
data from the UART.
DDIS can be used to change the direction
of data flow through a buffer.
DSR
Data set ready is an input to the 16550,
indicating that the modem or data set is
ready to operate.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
MR
Master reset initializes the 16550 and should
be connected to the system RESET signal.
OUT1, OUT2
User-defined output pins that can provide
signals to a modem or any other device as
needed in a system.
RCLCK
Receiver clock is the clock input to the
receiver section of the UART.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
RD, RD
Read inputs (either may be used) cause data to be read from
the register specified by the address inputs to the UART.
RI
Ring indicator input is placed at logic 0 by
the modem to indicate the phone is ringing.
RTS
Request-to-send is a signal to the modem
indicating that the UART wishes to send data.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
SIN, SOUT
These are the serial data pins. SIN accepts
serial data and SOUT transmits serial data.
RXRDY
Receiver ready is a signal used to transfer
received data via DMA techniques.
TXRDY
Transmitter ready is a signal used to
transfer transmitter data via DMA.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
WR, WR
Write (either may be used) connects to the microprocessor
write signal to transfer commands and data to the 16550.
XIN, XOUT
These are the main clock connections.
A crystal is connected across these pins to
form a crystal oscillator, or XIN is connected
to an external timing source.
Sample Initialization
Suppose an asynchronous system requires
seven data bits, odd parity a baud rate of
9600, and one stop bit.
Example 1124 lists a procedure to initialize
the 16550 to function in this manner.
Fig 1145 shows the interface to the 8088
microprocessor, using a PLD to decode the
8-bit port addresses F0H through F7H.
Figure 1145 The 16550 interfaced to the 8088 microprocessor at ports 00F0H
00F7H.
Figure 1147 The contents of the line status register of the 16550 UART.
UART Errors
Errors detected by 16550 are:
parity, framing, and overrun errors
Figure 1150 A DAC0830 interfaced to the 8086 microprocessor at 8-bit I/O location
20H.
Figure 1152 The timing diagram for the ADC0804 analog-to-digital converter.
Figure 1153 The analog inputs to the ADC0804 converter. (a) To sense a 0- to +5.0
V input. (b) To sense an input offset from ground.
Figure 1154 Connecting the RC circuit to the CLK IN and CLK R pins on the
ADC0804.
Figure 1156 A circuit that stores speech and plays it back through the speaker.
SUMMARY
The 8086-Core2 microprocessors have two
basic types of I/O instructions: IN and OUT.
The IN instruction inputs data from an
external I/O device into either the AL (8-bit)
or AX (16-bit) register.
The IN instruction is available as a fixed
port instruction, a variable port instruction,
or a string instruction (80286-Pentium 4)
INSB or INSW.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions
SUMMARY
(cont.)
SUMMARY
(cont.)
SUMMARY
(cont.)
SUMMARY
(cont.)
SUMMARY
(cont.)
SUMMARY
(cont.)
SUMMARY
(cont.)
SUMMARY
(cont.)
SUMMARY
(cont.)
SUMMARY
(cont.)
SUMMARY
The 16550 is a programmable
communications interface, capable of
receiving and transmitting asynchronous
serial data.
The DAC0830 is an 8-bit digital-to-analog
converter that converts a digital signal to an
analog voltage within 1.0 s.
The ADC0804 is an 8-bit analog-to-digital
converter that converts an analog signal
into a digital signal within 100 s.
The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium,
Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions