lect1-130erwerf202123206-phpapp01

Upload: jithendra-babu

Post on 03-Jun-2018

214 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    1/36

    8085

    MICROPROCESSOR

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    2/36

    Features

    8 bit microprocessor(8085 microprocessor can read orwrite or perform arithmetic and logical operations on 8-bitdata at time)

    It has 8 data lines and 16 address lines hence capacity is216 = 64 kB of memory

    Cock frequency is 3 MHz

    It requires +5V power supply.

    It is a single chip NMOS device implemented with 6200transistors.

    It provides 74 instructions with five addressing modes.

    It provides 5 hardware interrupt and 8 software interrupts.

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    3/36

    Pin Configuration

    40 pins classified into

    6 groups:

    1. Data bus

    2. Address bus3. Control & status lines

    4. Externally generated

    5. Serial interface

    6. Power supply & clock

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    4/36

    Pin Configuration cont

    1) Address Bus (A15-A8 and AD7-AD0):

    The microprocessor 8085 has 16 bit address linesfrom A15-A8 and AD7-AD0. These lines are used totransfer 16 bit address of memory as well as 8-bit addressof I/O ports.

    2) Data Bus:

    The lower 8 lines (AD7-AD0) are often called asmultiplexed data lines.

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    5/36

    CONTROL LINES

    RD : Read: This is active low signal which indicates that

    the selected I/O or memory device is to be read and alsois available on the data bus.

    WR : Write: This is active low signal which indicates thatthe data on data bus are to be written into a selectedmemory location.

    IO/ M : (Input / Output / Memory): This is used to selecteither Input / Output devices or memory operation. Whenit is high it indicates an I/O operation and when it is low, itindicates a memory operation.

    STATUS LINES Status Pins (S1, S0): The microprocessor 8085 has two

    status pins as S1, S0 which is used to indicate the statusof microprocessor or operation which is performed bymicroprocessor.

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    6/36

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    7/36

    SPECIAL SIGNAL

    ALE (Address Latch Enable): The ALE signal is used toenable or disable the external latch IC (74373/8212).

    The external latch IC is used for the de-multiplexing ofAD7-AD0 lines, i.e., it is used to separate the address anddata from AD7-AD0 lines.

    If ALE = 1/0 then external latch IC is enabled / disabledrespectively.

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    8/36

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    9/36

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    10/36

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    11/36

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    12/36

    Architecture 0f 8085 Cont

    1. ALU

    2. Timing and Control Unit

    3. General Purpose

    Registers4. Program Status word

    5. Program Counter

    6. Stack Pointer

    7. Instruction Register and

    Decoder

    8. Interrupt Control

    9.Serial I/O Control

    10.Address Bus

    11. Data Bus

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    13/36

    PROGRAMMING MODEL OF 8085

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    14/36

    REGISTERS

    The Registers are of 8-bit & 16-bit size used for different

    purposesA- Accumulator This is an specialpurpose register. All the ALU operations areperformed with reference to the contents of

    Accumulator.

    B,C,D,E,H,L General purpose registers.These registers can also used for 16-bit

    operations in pairs. The defaultpairs are BC, DE & HL.

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    15/36

    F

    Flag registerThis register indicates thestatus of the ALU operation.

    PC Program Counter This is a 16-bitregister used to address the memory locationfrom where an instruction is going to beexecuted.

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    16/36

    SP

    Stack pointer - This is a 16-bit registerused to address the top of the stack memorylocation.

    Temporary register, W & ZThese registersare only used by 8085 and are not available forthe programmer.

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    17/36

    ALU Arithmetic & Logic UnitALU of 8085 performs 8-bit arithmetic & logicaloperations. The operations are generally performed

    with Accumulator as one of the operands. The resultis saved in accumulator register.

    Timing & Control UnitThis unit works as the brain of the CPU andgenerates all the timing and control signals to

    perform all the internal & external operations of theCPU.

    Instruction Decoder & Machine Cycle Encoder UnitThis unit decodes the op-code stored in theInstruction Register (IR) and encodes it for the timing& control unit to perform the execution of theinstruction.

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    18/36

    The 8085 Bus Structure

    The 8-bit 8085 CPU (or MPU

    Micro Processing Unit) communicates with the otherunits using a 16-bit address bus, an 8-bit data bus and a control bus.

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    19/36

    Over all structure

    A15-A8

    LatchAD7-AD0

    D7- D

    0

    A7- A0

    8085

    ALE

    IO/MRDWR

    1K ByteMemory

    Chip

    WRRD

    CS

    A9- A0

    A15- A10Chip Selection

    Circuit

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    20/36

    MPU Communication and Bus Timing

    20

    Figure 3: Moving data form memory to MPU using instruction MOV C, A

    (code machine 4FH = 0100 1111)

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    21/36

    Instruction Set

    Broadly classified into two types:Based on word size:

    One word- Opcode only (CMA, ADD B)

    Two word- Opcode ,an operand (MVI A,32H)

    Three word- Opcode, operand, operand (LDA 4200, STA 4500)Based on function:

    Data transfer group (MOV A,B; MVI A,32H;MOV C,4500)

    Arithmetic operations (ADD B, SBI 32H,INC D, DEC B)

    Logical operations (ANA B, ORI 05H, RLC, RAR)

    Branching operations (JUMP, JMP, JNZ, JC, CALL,RETURN)

    Machine control instructions (HLT, NOP,EI,DI,SIM,RIM)

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    22/36

    ADDRESSING MODES

    Immediate (MOV A,B ;ADD B; SUB E;ANA C)

    Register (MVI A,05H;LXI B, 20AEH; ADI 05H;ORI 07H)

    Direct (LDA 4500H;STA 7500H;IN 09H;OUT 70H)

    Indirect (MOV A, M;MOV M,A;ADD M;ORA M)

    Implied(implicit) (HLT; NOP;RST;RET)

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    23/36

    Timing diagrams

    The 8085 microprocessor has 7 basic machine cycle. They are

    1. Op-code Fetch cycle(4T or 6T).

    2. Memory read cycle (3T)

    3. Memory write cycle(3T)4. I/O read cycle(3T)

    5. I/O write cycle(3T)

    6. Interrupt Acknowledge cycle(6T or 12T)

    7. Bus idle cycle

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    24/36

    Opcode fetch

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    25/36

    Memory read and memory write

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    26/36

    In/out read

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    27/36

    Eg:

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    28/36

    Eg:

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    29/36

    PROGRAMMING WITH

    8085

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    30/36

    8-BIT ADDITION & SUBTRACTION

    Program:MVI A, 04HMVI B, 06HMVI C, 00H

    ADD BJNC LP1INR CLP1: STA 4500H

    MOV A, CSTA 4501HHLT

    Program:MVI A, 06HMVI B, 04HMVI C, 00H

    SUB BJNC LP1INR CLP1: STA 4500H

    MOV A, CSTA 4501HHLT

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    31/36

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    32/36

    8 BIT DIVISION

    MVIA, 04 H

    MVIB, 02 H

    MVIC, 00 H

    #SUB B

    INR C

    JNC #

    ADD B

    DCR C

    STA 9000 H

    MOV A, C

    STA 9001 H

    HLT

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    33/36

    16BIT ADDITION &SUBTRATION:Program:

    MVI B, 00

    LXI H, 1111 H

    LXI D, 2222 H

    MOV A, L

    ADD E

    MOV L, A

    MOV A, H

    ADC D

    JNC #

    INR B

    # MOV H, A

    SHLD 9000 H

    MOV A, B

    STA 9002 H

    HLT

    Program:MVI B, 00 HLXI H, 2222 HLXI H, 1111 HMOV A, L

    SUB EMOV L, AMOV A, HSBB DJNC #INR B#MOV H, ASHLD 9000 HMOV A, BSTA 9002 HHLT

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    34/36

    16BIT MULTIPLICATION & DIVISIONProgram:

    LXI B, 0000 H

    LHLD C100 HSPHL

    LHLD C102 H

    XCHG

    LXI H, 0000 H

    @ DAD SP

    JNC *

    INX B

    *DCX D

    MOV A, D

    ORA E

    JNZ @

    SHLD 9000 H

    MOV L, C

    MOV H, B

    SHLD 9002 H

    Program:LXI B, 0000 H

    LHLD 9002 HXCHGLHLD 9000 H$INX BMOV A, LSUB E

    MOV L, AMOV A, HSBB DMOV H, ASBB DMOV H, A

    JNC $DAD DDCX BSHLD 9100 HMOV L, CMOV H, B

    SHLD 9102 H

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    35/36

    To find the greatest between two numbers:

    Program

    MVI B, 30HMVI C, 40H

    MOV A, B

    CMP C

    JZ EQUJC GRT

    OUT PORT1

    HLT

    EQU: MVI A, 01H

    OUT PORT1

    HLT

    GRT: MOV A, C

    OUT PORT1

    HLT

  • 8/12/2019 lect1-130erwerf202123206-phpapp01

    36/36

    Code conversion

    ASCII to decimal

    Decimal to ACSII

    BCD to HEXA

    Hexa to BCD Hexa to binary