intriduction ii

Upload: lim-hy

Post on 02-Jun-2018

223 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Intriduction II

    1/29

    KNL3473Microprocessor

    Introduction toMicroprocessors(II)

  • 8/10/2019 Intriduction II

    2/29

    Memory Read Operation - Step 1

    CPU Memory

    Address bus

    Data bus

    CPU places address (XXXX) of thememory location on the address bus

    Memory request

    Read

    The CPU sends out the control signalsMemory

    RequestandReadto indicate that it wants to

    read from memory

  • 8/10/2019 Intriduction II

    3/29

    Memory Read Operation - Step 2

    CPU Memory

    Address bus

    Data bus

    Memory request

    Read

    Accessed location at XXXX

    Memory places data from theaccessed location onto the data bus

  • 8/10/2019 Intriduction II

    4/29

    Memory Read Operation - Step 3

    CPU Memory

    Address bus

    Data bus

    Memory request

    Read

    Memory request

    Read

    The CPU removes theMemory Request

    andRead signals

    CPU latches the data into a register

    Register

  • 8/10/2019 Intriduction II

    5/29

    Memory Write Operation - Step 1

    CPU Memory

    Address bus

    Data bus

    CPU places address (YYYY) of thememory location on the address bus

    The CPU sends out aMemory Requestcontrol

    signal to indicate that it wants to perform a

    memory operation

    Memory request

  • 8/10/2019 Intriduction II

    6/29

    Memory Write Operation - Step 2

    CPU Memory

    Address bus

    Data bus

    Memory request

    CPU places the data from a register

    onto the data bus

    Register

    The CPU sends out a Writecontrol signal to

    indicate that valid data is available on the data

    bus

    Write

  • 8/10/2019 Intriduction II

    7/29

    Memory Write Operation - Step 3

    CPU Memory

    Address bus

    Data bus

    Memory request

    Memory copies the data bus into the

    accessed location

    Register

    Write

    Accessed locationat YYYY

    The CPU removes the Writesignal to complete

    the memory write operation

    Memory request

    Write

  • 8/10/2019 Intriduction II

    8/29

    Microprocessor System Vs Microcontroller System

    CPU

    General

    purpose

    Micro

    processor

    Data Bus

    Address Bus

    RAM ROM I / OPort

    TimerSerial

    COM

    Port

    CPU RAM ROM

    I / O

    PortTimer

    Serial

    COM

    Port

    General-Purpose Microprocessor System Microcontroller

  • 8/10/2019 Intriduction II

    9/29

    Microprocessor System Vs Microcontroller System

    P C

    Hardware

    Architecture

    Single-chip CPURAM-ROM ratio high

    Interrupt, I/O, Timer external.

    Not much on Real-time

    Single-chip ICROM-RAM ration high

    Interrupt, I/O, timer-InternalNeed to respond to Real time

    Application Microcomputer systemProcessing information

    Control oriented activitiesControl of I/O devices

    Instruction

    set

    Process intensive to handle

    Large volume of data

    Operates on byte, words,

    pointers, and arrays.Longer development time

    ANDing, ORing, XORing inbit level is less easy

    Control intensive to handle

    I/O using single Bit

    Operates mostly on Bit & byte

    shorter development time

    ANDing, ORing, XORing inbit level is easy

  • 8/10/2019 Intriduction II

    10/29

    Features 8-bit general-purpose microprocessor capable of addressing

    64K of memory.

    Intel 8085 microprocessor is the next generation of Intel 8080.8085s processing speed is faster than the 8080.

    The device has

    1. 40 pins2. Positive 5 V single power supply

    3. Operate with a 3-MHz single-phase clock

    4. 16 bit address bus

    5. 8 bit multiplex data bus

    6. Control and status signals

    7. Externally initiated signals

    8. Serial I/O ports.

  • 8/10/2019 Intriduction II

    11/29

    Common Microprocessor Internal

    Block Diagram

  • 8/10/2019 Intriduction II

    12/29

  • 8/10/2019 Intriduction II

    13/29

    Block Diagram

    1. Logic functions for data processing.

    2. Data handling.

    3. How each of these logic functions is

    connected to all the others. Referring to a block diagram makes it

    easier to see how to use a microprocessor

    in hardware and system design situations.

    The block diagram makes it easier to

    understand the architecture of a

    microprocessor.

  • 8/10/2019 Intriduction II

    14/29

    Status register word used in 8-bit

    Microprocessor

    P - Is set to 1 if the result has an even number of 1s.

    OIs set to 1 if carry happen between bit 6 and 7 or bit 7 and 8.

    IIs set to 1 if a carry happen between bit 3 and 4.

    CIs set to 1 if and arithmetic operation results in a carry.

    NIs set to 1 if bit 7 of the result =1.

    ZIs set to 1 when the result is zero.

  • 8/10/2019 Intriduction II

    15/29

    Continue

    Sometimes called a flag register. ALU operations set the status registers bits.

    The status register stores the results of tests forconditions that are generated by ALU operations.

    Data in the status register can be placed on themicroprocessor internal data bus but cannotreceived data from the microprocessor internaldata bus (read only).

    Mathematical operations can produce a carry bit,

    or they can result in a logic 0 (cleared register), orboth.

    If two 8-bit numbers are added, and their sum isgreater than 11111111, then a carry is generated.

  • 8/10/2019 Intriduction II

    16/29

    Example

    1. If we add 1110 1110 and 0111 0000, we get

    1110 1110

    + 0111 0000

    We get 1 0101 1110

    carry 8-bi t posit ive result

    This operation sets the status registers carrybit to log ic 1.

  • 8/10/2019 Intriduction II

    17/29

    Example

    2. If we add 0001 1111 and 0100 0001

    0001 1111

    + 0100 0001

    We get 0 0110 0000

    carry 8-bi t posit ive result

    The carry bit remains a logic 0.

  • 8/10/2019 Intriduction II

    18/29

    Example

    3. If we add 1110 1110 and 1111 0000, weget

    1110 1110

    + 1111 0000We get 1 1101 1110

    carry 8-bi t negative resu lt

    This sets the carry bit and thenegative bit to log ic 1.

  • 8/10/2019 Intriduction II

    19/29

    Accumulator

    Accumulator receives data from internaldata bus.

    The accumulator also sends its contents toother devices using the internal data bus.

    Is the microprocessors major workingregister.

    Is always a major part of themicroprocessors programming model.

    Hold data for manipulation.

    Most arithmetic and logic operations ondata use both the ALU and the accumulator.

  • 8/10/2019 Intriduction II

    20/29

    Examples

    Consider how the microprocessor adds two words, A and wordB.

    - First, word A is placed in the accumulator.

    - The addition is then executed by adding word B (the contents of a

    memory location) to word A (in the accumulator).

    - The resulting sum (C) is placed in the accumulator, replacing word

    A.- The result of an ALU operation is usually placed in theaccumulator.

    - The accumulators original contents are lost because they are

    overwritten.

    Data transfer.

    (Between an I/O port and a memory location, or between onememory location and another).

    - First, the data is moved from its source to the accumulator.

    - Then the data is moved from the accumulator to its destination.

  • 8/10/2019 Intriduction II

    21/29

  • 8/10/2019 Intriduction II

    22/29

    Example

    1) Data is found in the accumulator and in register D, neitherof which is connected to any other device at this time. Notethat the instruction register contains the instruction ADD.

  • 8/10/2019 Intriduction II

    23/29

    Continue2) The accumulators data is placed on the microprocessors internal data

    bus.

    - One of the ALUs temporary data registers is connected to the bus.- This temporary register is loaded with a copy of the data in the

    accumulator.

    - Only the accumulator and the temporary register use the internal databus at this time.

  • 8/10/2019 Intriduction II

    24/29

    Continue

    3) Register Ds data is placed on the microprocessors internal data bus.

    - The ALUs other temporary data register is connected to the bus.

    - This temporary register is loaded with a copy of the data in register D.

    - Only register D and the temporary register use the internal data bus atthis time.

  • 8/10/2019 Intriduction II

    25/29

    Continue

    4) The ALU is directed to add the data at its input ports.

    - Its output port is connected to the accumulator.

    - The result of the addition is placed in the accumulator.

    - Note: This addition sets the status registers negative, carry,

    overflow, and intermediate carry bits

    1101 1110

    + 1101 1010

    1 1011 1000

    carry negative

  • 8/10/2019 Intriduction II

    26/29

    Continue

    Status Register Word

    Status Register

    Accumulator Register

    0 1 1 1 0 1 1 1

  • 8/10/2019 Intriduction II

    27/29

    Continue

    5) The accumulators input port and output port are both turned off.

    - The sum resulting from the addition is in the accumulator, and

    the status register shows the new results.

    - The bus temporary registers and the instruction register are

    available for another operation.

    - Remember that the data bus moves data words, not bits.

  • 8/10/2019 Intriduction II

    28/29

    Basic Instruction Cycle

    Execute

    Instruction

    Start

    FetchInstruction

    End

    Fetch Cycle

    Execute Cycle

    PC = 0000H

    PC = PC + n

  • 8/10/2019 Intriduction II

    29/29