Вы находитесь на странице: 1из 15

16:16:56

Chapter 4
Interfacing methods
16:16:56
4.1 Introduction

4.1.1 Performance measures


• Latency: The time between when the I/O device needs service
and when service is initiated (hardware and software delays).
1. For an input device, software latency (or software response
time) is the time between new input data ready and the
software reading the data.
2. For an output device, latency is the delay from output device
idle and the software giving the device new data to output.
• Throughput or bandwidth is the maximum data flow (bytes per
second) that can be processed by the system.

Microcomputer principles and applications


16:16:56
4.1 Introduction

4.1.2 Synchronizing the software with the state of the I/O


Three states:
• The idle state: the device is disabled or inactive.
• The active state: the hardware toggles between the busy and
done states.
• The busy-to-done state: a busy-wait loop.
The I/O devices are usually much slower than software execution
⇒ need synchronization: The hardware and software waiting for
each other in a manner such that data are properly transmitted.

Microcomputer principles and applications


16:16:56
4.1 Introduction

Synchronization between software and input devices

Input device
Busy Done Busy Done
Software
Waiting for new input Read data Process data Waiting Read data

Time

Synchronization between software and output devices

Output device
Done Busy Done Busy
Software
Generate Write Generate Waiting Write Generate Waiting

Time

Microcomputer principles and applications


16:16:56
4.1 Introduction

Interfacing methods
• Blind: The software simply waits a fixed amount of time and
assumes the I/O will complete after that fixed delay. Used in
situations where the I/O speed is short and predictable.
• Busy-wait: The software waits for the done state. Used in
situations where the software system is relatively simple and
real-time response is not important.
• An interrupt: The hardware causes special software
execution.Used in situations where the software system is fairly
complicated or when real-time response is important.
• Periodic polling: Periodically check the I/O status. Used in
situations that require interrupts, but the I/O device does not
support interrupt requests.
• Direct memory access (DMA): Transfers data directly to/from
memory.Used in situations where bandwidth and latency are
important.
Microcomputer principles and applications
16:16:56
4.2 Timing diagrams

Symbol Input Output

The input must be valid The output must be valid

If the input were to fall Then the output will fall

If the input were to rise Then the output were to rise


Don’t care, will work Don’t care, output value is
regardless indeterminate
High impedance, tristate,
Not defined HiZ, not driven, floating

Microcomputer principles and applications


16:16:56
4.2 Timing diagrams

Timing diagram examples

Microcomputer principles and applications


16:16:56
4.3 Parallel I/O Interface

Parallel IO Interface between MCU and an output device

Output
MCU
device
WR
Busy
En

Microcomputer principles and applications


16:16:56
4.3 Parallel I/O Interface

Parallel IO Interface between MCU and an input device

Input
MCU
device
RD
Busy
En

Microcomputer principles and applications


16:16:56
4.3 Parallel I/O Interface

Parallel IO Interface between MCU and a general peripheral


device
Data Bus

Peripheral
MCU
device
WR/RD
Busy
En

Microcomputer principles and applications


16:16:56
4.4 Serial communication interface

A frame is the smallest complete unit of serial transmission.

One frame

5V
Serial port Start b b1 b b3 b b5 b b7 Stop



0V

A start bit (0), 8 bits of data (least significant bit first), and a stop bit
(1). This protocol is used for both transmitting and receiving.

Microcomputer principles and applications


16:16:56
4.4 Serial communication interface

Example: 74HC595 8-Bit Serial to Serial/Parallel IC.

• 8-bit
• Logical Function : Shift Register
• Output Type : 3-State

Microcomputer principles and applications


16:16:56
4.4 Serial communication interface

Microcomputer principles and applications


16:16:56
4.4 Serial communication interface

SHCP = Shift Register Clock Input = CLK DS = Serial Input = MOSI


STCP = Storage Register Clock Input = STRB (LAT)

Microcomputer principles and applications


16:16:56
4.4 Serial communication interface

P1.0 (LAT)
P1.1 (CLK)
P1.2 (DATA)
GND
VCC

Microcomputer principles and applications

Вам также может понравиться