EEM336 Microprocessors I. I/O Interface

Similar documents
Microprocessors and Microcontrollers (EE-231)

INTRO TO I/O INTERFACE

Basic I/O Interface. CEN433 King Saud University Dr. Mohammed Amer Arafah

The Purpose of Interrupt

Week 7. Input/Output Interface Circuits and LSI Peripheral Devices

PART B UNIT II PART A

Interface: Ports. Microprocessor System Design EHB432E Lecture - 6. Interface: Bus. Timing Diagrams. Istanbul Technical University

Serial Interfacing. Asynchronous Frame

Parallel Data Transfer. Suppose you need to transfer data from one HCS12 to another. How can you do this?

Introduction the Serial Communications Parallel Communications Parallel Communications with Handshaking Serial Communications

I/O Design. Input / Output Instructions. Engineering 4862 Microprocessors. Lecture 23. Cheng Li

INPUT-OUTPUT ORGANIZATION

Lecture 25 March 23, 2012 Introduction to Serial Communications

Understanding the basic building blocks of a microcontroller device in general. Knows the terminologies like embedded and external memory devices,

Computer Architecture

Microcontrollers. Fig. 1 gives a comparison of a microprocessor system and a microcontroller system.

Topics. Interfacing chips

Segment A Programmable Peripheral Interface (PPI)

Thorne : Section 20.1, 20.2 (Irvine Edition IV : Section 17.1) SYSC3006 1

Interfacing. Introduction. Introduction Addressing Interrupt DMA Arbitration Advanced communication architectures. Vahid, Givargis

Advanced Microprocessors

Sender Receiver Sender

Chapter 8 Summary: The 8086 Microprocessor and its Memory and Input/Output Interface

QUESTION BANK CS2252 MICROPROCESSOR AND MICROCONTROLLERS

Unit 5 DOS INTERRPUTS

Last class: Today: Course administration OS definition, some history. Background on Computer Architecture

QUIZ Ch.6. The EAT for a two-level memory is given by:

Design with Microprocessors

Microprocessor Architecture. mywbut.com 1

Lecture 23. Finish-up buses Storage

EEM336 Microprocessors I. Data Movement Instructions

COMP asynchronous buses April 5, 2016

Microprocessors/Microcontrollers

13. IN PORT: This is an ALP statement. PORT is the symbolic name given to 8-bit address of the input device available as a 2 nd byte of the

8254 is a programmable interval timer. Which is widely used in clock driven digital circuits. with out timer there will not be proper synchronization

CREATED BY M BILAL & Arslan Ahmad Shaad Visit:

Adding PC Connectivity to the MTS-88 Microcomputer Teaching. Omar Walid Abdul-Wahab, Wameedh Nazar Flayyih. System

MICROPROCESSOR TECHNOLOGY

ECE 485/585 Microprocessor System Design

4 Multiplexer. Y Fig Keyboard Scan Matrix

PD215 Mechatronics. Week 3/4 Interfacing Hardware and Communication Systems

Pin Description, Status & Control Signals of 8085 Microprocessor

Summer 2003 Lecture 21 07/15/03

CS 101, Mock Computer Architecture

Serial Communications

SRI VIDYA COLLEGE OF ENGINEERING AND TECHNOLOGY,VIRUDHUNAGAR

Digital System Design

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:

Introduction To Computer Hardware. Hafijur Rahman

Unit 1. Chapter 3 Top Level View of Computer Function and Interconnection

Input/Output Problems. External Devices. Input/Output Module. I/O Steps. I/O Module Function Computer Architecture

Lecture Objectives. Introduction to Computing Chapter 0. Topics. Numbering Systems 04/09/2017

Chapter 5 - Input / Output

Computer System Overview

UNIT V MICRO CONTROLLER PROGRAMMING & APPLICATIONS TWO MARKS. 3.Give any two differences between microprocessor and micro controller.

8. I/O Buses and Interfaces

Computer System Overview OPERATING SYSTEM TOP-LEVEL COMPONENTS. Simplified view: Operating Systems. Slide 1. Slide /S2. Slide 2.

Lecture-55 System Interface:

EB-51 Low-Cost Emulator

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI UNIT IV I/O INTERFACING PART A (2 Marks)

Chapter ELEVEN 8255 I/O PROGRAMMING

BASIC INTERRUPT PROCESSING

A+ Guide to Hardware: Managing, Maintaining, and Troubleshooting, 5e. Chapter 1 Introducing Hardware

Chapter 4 : Microprocessor System

Serial Interfaces Part 1. ECE 153B Sensor & Peripheral Interface Design Winter 2016

About the Presentations

Generic Model of I/O Module Interface to CPU and Memory Interface to one or more peripherals

ECE 485/585 Microprocessor System Design

8255 Programmable Peripheral Interface Architecture MCT/UNIT III/NARASIMHARAJ/LECTURE NOTES /IV MECH A

Assembly Language for x86 Processors 7 th Edition. Chapter 2: x86 Processor Architecture

Organisasi Sistem Komputer

Basic I/O Interface

Lecture 11: Speed & Communications

Bus System. Bus Lines. Bus Systems. Chapter 8. Common connection between the CPU, the memory, and the peripheral devices.

Chapter 9: A Closer Look at System Hardware

EC2304-MICROPROCESSOR AND MICROCONROLLERS 2 marks questions and answers UNIT-I

Chapter 9: A Closer Look at System Hardware 4

EEM336 Microprocessors I. The Microprocessor and Its Architecture

To Interface The 8085 Microprocessor

Chapter 3. Top Level View of Computer Function and Interconnection. Yonsei University

MICROPROCESSOR AND MICROCONTROLLER BASED SYSTEMS

EE 3170 Microcontroller Applications

Chapter 12: INTERRUPTS

Unit 3 and Unit 4: Chapter 4 INPUT/OUTPUT ORGANIZATION

Module 6: INPUT - OUTPUT (I/O)

Functional Units of a Modern Computer

7/19/2013. Introduction. Chapter Objectives Upon completion of this chapter, you will be able to: Chapter Objectives 12 1 BASIC INTERRUPT PROCESSING

Computer Organization and Microprocessors SYLLABUS CHAPTER - 1 : BASIC STRUCTURE OF COMPUTERS CHAPTER - 3 : THE MEMORY SYSTEM

Serial Interfacing. Pulse width of 1 bit

THE MICROCOMPUTER SYSTEM CHAPTER - 2

Chapter 12: Interrupts

CS 16: Assembly Language Programming for the IBM PC and Compatibles

Modes of Transfer. Interface. Data Register. Status Register. F= Flag Bit. Fig. (1) Data transfer from I/O to CPU

COMP 273 Winter asynchronous I/O April 5, 2012

Architecture of Computers and Parallel Systems Part 2: Communication with Devices

Input/Output Systems

Materials: 1. Projectable Version of Diagrams 2. MIPS Simulation 3. Code for Lab 5 - part 1 to demonstrate using microprogramming

EC 6504 Microprocessor and Microcontroller. Unit II System Bus Structure

Computers Are Your Future

Lecture-65 SERIAL DATA COMMMUNICATION The data bus of a microcomputer system is designed to transfer data to and from I/O device in parallel - all

Transcription:

EEM336 Microprocessors I I/O Interface

Introduction Basic I/O interface Handshaking process Serial and Parallel communication I/O interface examples 2

Chapter Objectives Upon completion of this chapter, you will be able to: Explain the operation of the basic input and output interfaces. Use I/O instructions. Define handshaking and explain how to use it with I/O devices. 3

Chapter Objectives Upon completion of this chapter, you will be able to: Learn the differences between serial and parallel communication. Understand how to interface external devices to the microprocessor via I/O ports. Use virtual devices provided with the emulator. 4

INTRO TO I/O INTERFACE A microprocessor is great at solving problems. But, if it can not communicate with the outside world, it is of little worth. Therefore, I/O interface is of great importance. 5

INTRO TO I/O INTERFACE I/O instructions (IN, INS, OUT, and OUTS) are explained in this lecture. Also isolated (direct or I/O mapped I/O) and memory-mapped I/O, the basic input and output interfaces, and handshaking. Knowledge of these topics makes it easier to understand the connection and operation of the programmable interface components and I/O techniques. 6

The I/O Instructions One type of instruction transfers information to an I/O device (OUT). Another reads from an I/O device (IN). Instructions are also provided to transfer strings of data between memory and I/O. INS and OUTS, found except the 8086/8088 7

Instructions that transfer data between an I/O device and the microprocessor s accumulator (AL, AX, or EAX) are called IN and OUT. The I/O address is stored in register DX as a 16-bit address or in the byte (p8) immediately following the opcode as an 8-bit address. The 16-bit address is called a variable address because it is stored in a DX, and then used to address the I/O device. 8

Other instructions that use DX to address I/O are the INS and OUTS instructions. I/O ports are 8 bits in width. a 16-bit port is actually two consecutive 8-bit ports being addressed a 32-bit I/O port is actually four 8-bit ports 9

When data are transferred using IN or OUT, the I/O address, (port number or simply port), appears on the address bus. External I/O interface decodes the port number in the same manner as a memory address. the 8-bit fixed port number (p8) appears on address bus connections A 7 A 0 with bits A 15 A 8 equal to 00000000 2 connections above A 15 are undefined for I/O instruction 10

The 16-bit variable port number (DX) appears on address connections A 15 A 0. The first 256 I/O port addresses (00H FFH) are accessed by both fixed and variable I/O instructions. any I/O address from 0100H to FFFFH is only accessed by the variable I/O address In a PC computer, all 16 address bus bits are decoded with locations 0000H 03FFH. used for I/O inside the PC on the ISA (industry standard architecture) bus 11

INS and OUTS instructions address an I/O device using the DX register. but do not transfer data between accumulator and I/O device as do the IN/OUT instructions Instead, they transfer data between memory and the I/O device Pentium 4 and Core2 operating in the 64-bit mode have the same I/O instructions. There are no 64-bit I/O instructions in the 64- bit mode. most I/O is still 8 bits and likely will remain so 12

Summary of I/O instructions IN AL, p8 IN AX, p8 IN AL, DX IN AX, DX OUT p8, AL OUT p8, AX OUT DX, AL OUT DX, AX p8: A port number between 0 and 255 For other port numbers, use DX register. 13

Isolated and Memory-Mapped I/O Two different methods of interfacing I/O: isolated I/O and memory-mapped I/O. In isolated I/O, the IN, INS, OUT, and OUTS transfer data between the microprocessor s accumulator or memory and the I/O device. In memory-mapped I/O, any instruction that references memory can accomplish the transfer. The PC does not use memory-mapped I/O. 14

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 Addresses for isolated I/O devices, called ports, are separate from memory. Because the ports are separate, the user can expand the memory to its full size without using any of memory space for I/O devices. 15

A disadvantage of isolated I/O is that data transferred between I/O and microprocessor must be accessed by the IN, INS, OUT, and OUTS instructions. Separate control signals for the I/O space are developed (using M/IO and W/R ), which indicate an I/O read (IORC) or an I/O write (RD) operation. These signals indicate an I/O port address, which appears on the address bus, is used to select the I/O device. 16

Figure 11 1 The memory and I/O maps for the 8086/8088 microprocessors. (a) Isolated I/O. (b) Memory-mapped I/O. in the PC, isolated I/O ports are used to control peripheral devices an 8-bit port address is used to access devices located on the system board, such as the timer and keyboard interface a 16-bit port is used to access serial and parallel ports, video and disk drive systems 17

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 Advantage is any memory transfer instruction can access the I/O device. Disadvantage is a portion of memory system is used as the I/O map. reduces memory available to applications 18

Personal Computer I/O Map the PC uses part of I/O map for dedicated functions, as shown here I/O space between ports 0000H and 03FFH is normally reserved for the system and ISA bus ports at 0400H FFFFH are generally available for user applications, mainboard functions, and the PCI bus 80287 coprocessor uses 00F8H 00FFH, so Intel reserves I/O ports 00F0H 00FFH Figure 11 2 I/O map of a personal computer illustrating many of the fixed I/O areas. 19

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 20

Fig 11 5 illustrates typical input and output connections found on a printer. data transfers via data connections (D 7 D 0 ) ASCII data are placed on D 7 D 0, and a pulse is then applied to the STB connection. BUSY indicates the printer is busy STB is a clock pulse used to send data to printer The strobe signal sends or clocks the data into the printer so that they can be printed. as the printer receives data, it places logic 1 on the BUSY pin, indicating it is printing data 21

Figure 11 5 The DB25 connector found on computers and the Centronics 36-pin connector found on printers for the Centronics parallel printer interface. 22

The software polls or tests the BUSY pin to decide whether the printer is busy. If the printer is busy, the processor waits if not, the next ASCII character goes to the printer This process of interrogating the printer, or any asynchronous device like a printer, is called handshaking or polling. 23

I/O COMMUNICATION METHODS 1. Serial communication 2. Parallel communication Serial communication is the process of sending data one bit at one time, sequentially, over a communication channel or computer bus. In parallel communication, on the other hand, several bits are sent together on a link comprising of several wired channels in parallel. 24

Examples of serial communication architectures RS-232 I²C (Inter Integrated Circuit) SPI (Serial Peripheral Interface) USB (Universal Serial Bus) FireWire Ethernet Fibre Channel SATA (Serial Advanced Technology Attachment) PCI (Peripheral Component Interconnect) Express 25

Examples of parallel communication architectures Printer port ISA (Industry Standard Architecture) ATA (Advanced Technology Attachment ) SCSI (Small Computer System Interface) PCI 26

Serial vs Parallel Serial circuitry is simple and cheap. Parallel circuitry is complex and expensive. In parallel communication, you can send many bits at once; however, receive 'at once' is not a true statement. Each bit travels a slightly different path down the cable and to a different pin on the chip. The small differences in path length that each bit travels becomes more and more significant as speed increases. Therefore, some sort of buffering and synchronization is necessary. In serial communication, no such a problem exists. So, after a certain speed and distance threshold, serial communication is superior. 27

Interfacing processors to serial and parallel devices Processors use peripheral interface circuits to interface to serial and parallel devices. These circuits are either provided as separate integrated circuits or built inside the processor. Examples: A UART (Universal asynchronous receiver/transmitter) is used for serial communications over a computer or peripheral device serial port. Intel 8255 chip is used to give the CPU access to programmable parallel I/O. 28

I/O INTERFACE EXAMPLES Traffic Lights Emulation Traffic lights are controlled by sending data to I/O port 4. There are 12 lamps: 4 green 4 yellow 4 red. 29

Traffic Lights Emulation You can set the state of each lamp by setting its bit: 1 - the lamp is turned on. 0 - the lamp is turned off. Bits (12 to 15) are unused. For example, all lights will be red when following code is executed: MOV AX, 0000001001001001b OUT 4, AX 30

Stepper Motor The stepper motor is controlled by sending data to I/O port 7. Stepper motor is electric motor that can be precisely controlled by signals from a computer. The motor turns through a precise angle each time it receives a signal. 31

Stepper Motor By varying the rate at which signal pulses are produced, the motor can be run at different speeds or turned through an exact angle and then stopped. This is a basic 3-phase stepper motor, it has 3 magnets controlled by bits 0, 1 and 2. other bits (3..7) are unused. 32

Stepper Motor When magnet is working it becomes red. The arrow in the left upper corner shows the direction of the last motor move. Green line is here just to see that it is really rotating. 33

Stepper Motor If you ever played with magnets you will understand how it works. Just activate the magnets in a precise order. For example, the code below will do three clock-wise half-steps: MOV AL, 001b ; initialize OUT 7, AL MOV AL, 011b ; half step 1 OUT 7, AL MOV AL, 010b ; half step 2 OUT 7, AL MOV AL, 110b ; half step 3 OUT 7, AL 34

Stepper Motor Four-Coil Stepper Motor that uses an Armature with a Single Pole 35

Robot The robot is controlled by sending data to I/O port 9. 36

Robot The first byte (port 9) is a command register. Send data to this port to make the robot do something. 37

Robot The second byte (port 10) is a data register. This register is set after robot completes the examine command: 38

Robot The third byte (port 11) is a status register. Read values from this port to determine the state of the robot. Each bit has a specific property: 39

Robot Example: MOV AL, 1 ; move forward. OUT 9, AL ; MOV AL, 3 ; turn right. OUT 9, AL ; MOV AL, 1 ; move forward. OUT 9, AL ; MOV AL, 2 ; turn left. OUT 9, AL ; MOV AL, 1 ; move forward. OUT 9, AL ; 40

Robot Keep in mind that robot is a mechanical creature and it takes some time for it to complete a task. You should always check bit#1 of status register before sending data to port 9. Otherwise the robot will reject your command and "busy!" will be shown. Remember handshaking process! 41

The Intel Microprocessors: 8086/8088, 80186/80188, 80286, 80386, 80486 Pentium, Pentium Pro Processor, Pentium II, Pentium, 4, and Core2 with 64-bit Extensions Architecture, Programming, and Interfacing, Eighth Edition Barry B. Brey Copyright 2009 by Pearson Education, Inc. Upper Saddle River, New Jersey 07458 All rights reserved. 42