MICROPROCESSOR INPUT/OUTPUT

Slides:



Advertisements
Similar presentations
I/O Organization popo.
Advertisements

Computer Architecture
Parul Polytechnic Institute
Chapter 10 Input/Output Organization. Connections between a CPU and an I/O device Types of bus (Figure 10.1) –Address bus –Data bus –Control bus.
1/1/ / faculty of Electrical Engineering eindhoven university of technology Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir.
I/O Unit.
Processor System Architecture
CS-334: Computer Architecture
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
FIU Chapter 7: Input/Output Jerome Crooks Panyawat Chiamprasert
Interrupts (contd..) Multiple I/O devices may be connected to the processor and the memory via a bus. Some or all of these devices may be capable of generating.
COMP3221: Microprocessors and Embedded Systems Lecture 15: Interrupts I Lecturer: Hui Wu Session 1, 2005.
6-1 I/O Methods I/O – Transfer of data between memory of the system and the I/O device Most devices operate asynchronously from the CPU Most methods involve.
1 Computer System Overview OS-1 Course AA
Introduction An interrupt is an event which informs the CPU that its service (action) is needed. Sources of interrupts: internal fault (e.g.. divide by.
Basic Input/Output Operations
1 Interrupts INPUT/OUTPUT ORGANIZATION: Interrupts CS 147 JOKO SUTOMO.
INPUT/OUTPUT ORGANIZATION INTERRUPTS CS147 Summer 2001 Professor: Sin-Min Lee Presented by: Jing Chen.
1 COSC 3P92 Cosc 3P92 Week 11 Lecture slides Violence is the last refuge of the incompetent. Isaac Asimov, Salvor Hardin in "Foundation"
GURSHARAN SINGH TATLA PIN DIAGRAM OF 8085 GURSHARAN SINGH TATLA
Group 7 Jhonathan Briceño Reginal Etienne Christian Kruger Felix Martinez Dane Minott Immer S Rivera Ander Sahonero.
2. Methods for I/O Operations
1 Computer System Overview Chapter 1 Review of basic hardware concepts.
Chapter 7 Input/Output Luisa Botero Santiago Del Portillo Ivan Vega.
Khaled A. Al-Utaibi  Intel Peripheral Controller Chips  Basic Description of the 8255  Pin Configuration of the 8255  Block Diagram.
Interrupts. What Are Interrupts? Interrupts alter a program’s flow of control  Behavior is similar to a procedure call »Some significant differences.
Chapter 10: Input / Output Devices Dr Mohamed Menacer Taibah University
1 Computer System Overview Chapter 1. 2 n An Operating System makes the computing power available to users by controlling the hardware n Let us review.
1. Introduction 2. Methods for I/O Operations 3. Buses 4. Liquid Crystal Displays 5. Other Types of Displays 6. Graphics Adapters 7. Optical Discs 10/01/20151Input/Output.
CHAPTER 3 TOP LEVEL VIEW OF COMPUTER FUNCTION AND INTERCONNECTION
Khaled A. Al-Utaibi  Interrupt-Driven I/O  Hardware Interrupts  Responding to Hardware Interrupts  INTR and NMI  Computing the.
Computer Architecture Lecture10: Input/output devices Piotr Bilski.
(More) Interfacing concepts. Introduction Overview of I/O operations Programmed I/O – Standard I/O – Memory Mapped I/O Device synchronization Readings:
COMPUTER ORGANIZATIONS CSNB123 NSMS2013 Ver.1Systems and Networking1.
Computer Architecture Lecture 2 System Buses. Program Concept Hardwired systems are inflexible General purpose hardware can do different tasks, given.
Accessing I/O Devices Processor Memory BUS I/O Device 1 I/O Device 2.
13-Nov-15 (1) CSC Computer Organization Lecture 7: Input/Output Organization.
Microprocessor. Interrupts The processor has 5 interrupts. CALL instruction (3 byte instruction). The processor calls the subroutine, address of which.
L/O/G/O Input Output Chapter 4 CS.216 Computer Architecture and Organization.
The computer system’s I/O architecture is its interface to the outside world. This architecture provides a systematic means of controlling interaction.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Input/Output Problems Wide variety of peripherals —Delivering different amounts of data —At different speeds —In different formats All slower than CPU.
IT3002 Computer Architecture
I/O Organization Competency – C6. Important facts to remember when I/O devices are to be connected to CPU There is a vast variety of I/O devices. Some.
بسم الله الرحمن الرحيم MEMORY AND I/O.
The 8085 Microprocessor Architecture. What 8085 meant for? 80 - year of invention bit processor 5 - uses +5V for power.
Chapter 3 System Buses.  Hardwired systems are inflexible  General purpose hardware can do different tasks, given correct control signals  Instead.
1 Device Controller I/O units typically consist of A mechanical component: the device itself An electronic component: the device controller or adapter.
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
MICROPROCESSOR BASED SYSTEM DESIGN
Computer Architecture
Interrupts In 8085 and 8086.
E3165 DIGITAL ELECTRONIC SYSTEM
An Introduction to Microprocessor Architecture using intel 8085 as a classic processor
11.1 Interrupt Mechanism, Type, and Priority
X1 & X2 These are also called Crystal Input Pins.
BIC 10503: COMPUTER ARCHITECTURE
Interrupts.
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
Md. Mojahidul Islam Lecturer Dept. of Computer Science & Engineering
COMP3221: Microprocessors and Embedded Systems
Presentation transcript:

MICROPROCESSOR INPUT/OUTPUT Chapter 4 MICROPROCESSOR INPUT/OUTPUT

Outline 4.1 Introduction 4.2 Simple I/O Devices 4.3 Programmed I/O 4.4 Unconditional and Conditional Programmed I/O 4.5 Interrupt I/O 4.6 Direct Memory Access (DMA) Summary of I/O

4.1 Introduction The technique of data transfer between a microcomputer and an external device is called input/output (I/O). Peripherals are the I/O devices that connected to a microcomputer and provide an efficient means of communication between the microcomputer and the outside world.

4.1 Introduction Because the characteristics of I/O devices are normally different from those of a microcomputer like (speed and word length) we need interface hardware circuitry between the microcomputer and I/O devices Interface hardware provide all input and output transfers between the microcomputer and peripherals by using an I/O bus. An I/O bus carries three types of signals: device address, data, and command.

4.1 Introduction There are three ways of transferring data between a microcomputer and physical I/O devices: programmed I/O, interrupt I/O and direct memory access.

4.1 Introduction Programmed I/O, the microprocessor executes a program to perform all data transfers between the microcomputer and the external device. The main characteristic of this type of I/O technique is that the external device carries out the functions dictated by the program inside the microcomputer memory.

4.1 Introduction Interrupt I/O, an external device can force the microprocessor to stop executing the current program temporarily so that it can execute another program known as an interrupt service routine. After completing this program, a return from interrupt instruction can be executed at the end of the service routine to return control at the right place in the main program.

4.1 Introduction Direct memory access (DMA) is a type of I/O technique in which data can be transferred between microcomputer memory and an external device such as the hard disk, without microprocessor involvement. A special chip called the DMA controller chip is typically used with the microprocessor for transferring data using DMA.

4.2 Simple I/O Devices For reading only

4.3 Programmed I/O A microcomputer communicates with an external device via one or more registers called I/O ports using programmed I/O. I/O ports are usually of two types. For one type, each bit in the port can be configured individually as either input or output. For the other type, all bits in the port can be set up as all parallel input or parallel output bits.

4.3 Programmed I/O Command or data-direction register Is a register used to configure each port as an input or output port. The port contains the actual input or output data. The data direction register is an output register and can be used to configure the bits in the port as inputs or outputs.

4.3 Programmed I/O As an example, if an 8-bit data-direction register contains 34H (34 Hex), the corresponding port is defined as shown in Figure 4.4.

4.3 Programmed I/O For parallel I/O, there is only one data direction register for all ports. A particular bit in the data direction register configures all bits in the port as either inputs or outputs.

4.3 Programmed I/O I/O ports are addressed using either standard I/O or memory-mapped I/O techniques. 1. Standard I/O or port I/O (called isolated I/O by Intel) uses an output pin such as the M / IO pin 2. In memory-mapped I/O, the microprocessor does not use the M / IO control pin. Instead, the microprocessor uses an unused address pin to distinguish between memory and I/O.

4.3 Programmed I/O

4.4 Unconditional and Conditional Programmed I/O There are typically two ways in which programmed I/O can be utilized: unconditional I/O and conditional I/O. The microprocessor can send data to an external device at any time using unconditional I/O. In conditional I/O, the microprocessor outputs data to an external device via handshaking. This means that data transfer occurs via the exchange of control signals between the microprocessor and an external device.

4.4 Unconditional and Conditional Programmed I/O The concept of conditional I/0 will now be demonstrated by means of data transfer between a microprocessor and an analog-to- digital (A/D) converter.

4.4 Unconditional and Conditional Programmed I/O

4.4 Unconditional and Conditional Programmed I/O

4.5 Interrupt I/O A disadvantage of conditional programmed I/O is that the microcomputer needs to check the status bit (a conversion complete signal of the A/D converter) by waiting in a loop. Interrupt I/O is a device-initiated I/O transfer. The external device is connected to a pin called the interrupt (INT) pin on the microprocessor chip.

4.5 Interrupt I/O How Interrupt work ?? 1. When the device needs an I/O transfer with the microcomputer, it activates the interrupt pin of the processor chip. 2. The microcomputer usually completes the current instruction and saves the contents of the current program counter and the status register in the stack.

4.5 Interrupt I/O How Interrupt work ?? 3. The microcomputer then loads an address automatically into the program counter to branch to a subroutine-like program called the interrupt service routine 4. The last instruction of the service routine is a RETURN, which is typically similar in concept to the RETURN instruction used at the end of a subroutine.

4.5 Interrupt I/O Assume that the microcomputer is 68000 based and is executing the following instruction sequence:

4.5 Interrupt I/O Assume that the address of service routine, is $4000 and that the user writes a service routine to input the A/D converter’s output as follows:

4.5.1 Interrupt types There are typically three types of interrupts: external interrupts, traps or internal interrupts,and software interrupts External interrupts can be divided further into two types: maskable and nonmaskable. Nonmaskable interrupt cannot be enabled or disabled by instructions, whereas a microprocessor’s instruction set contains instructions to enable or disable maskable interrupt

4.5.1 Interrupt types A nonmaskable interrupt is typically used as a power failure interrupt.

4.5.1 Interrupt types Internal interrupts, or traps, are activated internally by exceptional conditions such as overflow, division by zero, or execution of an illegal op-code. Many microprocessors include software interrupts, or system calls. When one of these instructions is executed, the microprocessor is interrupted and serviced similarly to external or internal interrupts.

4.5.1 Interrupt types Software interrupt instructions are normally used to call the operating system. These instructions are shorter than subroutine calls, and no calling program is needed to know the operating system’s address in memory.

4.5.2 Interrupt Address Vector Is the technique used to find the starting address of the service routine

4.5.3 Saving the Microprocessor Registers When a microprocessor is interrupted, it normally saves the program counter (PC) and the status register (SR) onto the stack so that the microprocessor can return to the main program with the original values of PC and SR after executing the service routine.

4.5.4 Interrupt Priorities It is a special mechanism necessary to handle interrupts from several devices that share one of these interrupt lines. There are two ways of servicing multiple interrupts: Polled technique Daisy chain technique.

4.5.4 Interrupt Priorities Polled Interrupts The microprocessor responds to an interrupt by executing one general service routine for all devices. The priorities of devices are determined by the order in which the routine polls each device.

4.5.4 Interrupt Priorities Polled Interrupts

4.5.4 Interrupt Priorities Polled Interrupts several external devices (device 1, device 2,. . . , device N) are connected to a single interrupt line of a microprocessor via an OR gate When one or more devices activate the INT line HIGH, the microprocessor pushes the PC and SR onto the stack. The user can write a program at this address to poll each device, starting with the highest- priority device, to find the source of the interrupt.

4.5.4 Interrupt Priorities Polled Interrupts Suppose that the devices in Figure 4.10 are A/D converters.

4.5.4 Interrupt Priorities Polled Interrupts (example A/D converter) Suppose that the user assigns device 2 the higher priority. When the “Conversion complete” signals from device 1 and/or 2 become HIGH, the processor is interrupted. In response, the microprocessor pushes the PC and SR onto the stack and loads the PC with the interrupt address vector defined by the manufacturer. If this device 2 has generated an interrupt, the output (PB 1) of the AND gate in Figure 4.11 becomes HIGH

4.5.4 Interrupt Priorities Polled Interrupts Polled interrupts are slow, and for a large number of devices the time required to poll each device may exceed the time to service the device. In such a case, a faster mechanism, such as the daisy chain approach, can be used.

4.5.4 Interrupt Priorities Daisy Chain Interrupts Devices are connected in daisy chain fashion, as shown in Figure 4.12, to set up priority systems. Suppose that one or more devices interrupt the processor. In response, the micropro-cessor pushes the PC and SR onto the stack and, generates an interrupt acknowledge (INTA) signal to the highest-priority- device (device 1 in this case).

4.5.4 Interrupt Priorities Daisy Chain Interrupts If this device has generated the interrupt, it w ill accept the INTA; otherwise, it will pass the INTA onto the next device until the INTA is accepted. Once accepted, the device provides a means for the processor to find the interrupt address vector by using external hardware.

4.5.4 Interrupt Priorities Daisy Chain Interrupts

4.5.4 Interrupt Priorities Daisy Chain Interrupts (example A/D Converter)

4.5.4 Interrupt Priorities Daisy Chain Interrupts (example A/D Converter) When the “conversion complete” signal goes HIGH, the microprocessor is interrupted through the INT line. The microprocessor pushes the PC and SR. It then generates a LOW at the interrupt acknowledge (INTA) for the highest-priority device. Device #1 has the highest priority; it is the first device in the daisy chain configuration to receive INTA . If A/D converter 1 has generated the “conversion complete” HIGH, the output of the AND gate in Figure 4.13 becomes HIGH.

4.6 Direct Memory Access (DMA) Direct memory access (DMA) is a technique that transfers data between a microcomputer’s memory and an I/O device without involving the microprocessor. The DMA technique uses a DMA controller chip for the data transfer operations.

4.6 Direct Memory Access (DMA) DMA controller chip Functions The I/O devices request DMA operation via the DMA request line of the controller chip. The controller chip activates the microprocessor HOLD pin, requesting the microprocessor to release the bus. The microprocessor sends HLDA (hold acknowledge) back to the DMA controller, indicating that the bus is disabled. The DMA controller places the current value of its internal registers, on the system bus and sends a DMA acknowledge to the peripheral device.

4.6 Direct Memory Access (DMA) DMA controller chip Types There are three basic types of DMA: Block transfer DMA Cycle stealing DMA Interleaved DMA.

4.6 Direct Memory Access (DMA) DMA controller chip Types Block transfer DMA The DMA controller chip takes over the bus from the microcomputer to transfer data between the microcomputer memory and the I/O device. The microprocessor has no access to the bus until the transfer is completed.

4.6 Direct Memory Access (DMA) DMA controller chip Types cycle stealing DMA Data transfer between the microcomputer memory and an I/O device occurs on a word-by-word basis

4.6 Direct Memory Access (DMA) DMA controller chip Types cycle stealing DMA The microprocessor is generated by ANDing an INHIBIT signal with the system clock. The DMA controller controls the INHIBIT line. During normal operation, the INHIBIT line is HIGH, providing the microprocessor clock. When DMA operation is desired, the controller makes the INHIBIT line LOW for one clock cycle. The microprocessor is then stopped completely for one cycle. Data transfer between the memory and I/O takes place during this cycle.

4.6 Direct Memory Access (DMA) DMA controller chip Types cycle stealing DMA This method is called cycle stealing because the DMA controller takes away or steals a cycle without microprocessor recognition. Data transfer takes place over a period of time.

4.6 Direct Memory Access (DMA) DMA controller chip Types interleaved DMA, The DMA controller chip takes over the system bus when the microprocessor is not using it. The DMA controller chip identifies these cycles and allows transfer of data between memory and the I/O device. Data transfer for this method takes place over a period of time.

4.6 Direct Memory Access (DMA) DMA controller chip (How it works)

4.6 Direct Memory Access (DMA) DMA controller chip (How it works) The DMA controller chip usually has at least three registers normally selected by the controller's register select (RS) line: An address register, A terminal count register, And a status register. Both the address and terminal counter registers are initialized by the microprocessor. The address register contains the starting address of the data to be transferred, and the terminal counter register contains the block to be transferred. The status register contains information such as completion of DMA transfer. Note that the DMA controller implements logic associated with data transfer in hardware to speed up the DMA operation.

4.6 Direct Memory Access (DMA) DMA controller chip (How it works) The address register contains the starting address of the data to be transferred. The terminal counter register contains the block to be transferred. The status register contains information such as completion of DMA transfer. Note that the DMA controller implements logic associated with data transfer in hardware to speed up the DMA operation.

4.7 Summary of I / O