Microprocessor and Microcontroller Labmanual

Embed Size (px)

Citation preview

  • 8/10/2019 Microprocessor and Microcontroller Labmanual

    1/33

    SSN COLLEGE OF ENGINEERING

    DEPARTMENT OF ELECTRICAL & ELECTRONICS

    ENGINEERING

    LAB MANUAL

    EE2356 MICROPROCESSOR & MICRO CONTROLLER

    LABORATORY

    DEC 2010-APRIL 2011

  • 8/10/2019 Microprocessor and Microcontroller Labmanual

    2/33

    Expt.No. Name of the experiment1 Arithmetic operations using 8085 Microprocessor.

    2a Sorting of numbers (Ascending & descending) using 8085 Microprocessor.

    2b Number conversions (BCD HEX, HEX BCD).

    3 Arithmetic operations using 8086 Microprocessor.

    4a Interfacing 8 bit ADC Converter with 8085 Microprocessor.

    4b Interfacing 8 bit DAC Converter with 8085 Microprocessor.

    5 Traffic Light controller using 8085 Microprocessor.

    6a Square Wave Generation using 8254

    6b Serial Data Transmission using 8251

    7 Interfacing 8279 with 8085 microprocessor

    8 8 bit Arithmetic operations using 8051 Microcontroller.

    9 Finding the smallest and largest number in an array of numbers using 8051Microcontroller

    10 Interfacing 8 bit DAC Converter with 8051 Microcontroller

    11 Interfacing of Stepper Motor with 8051 Microcontroller

    12 Interfacing Traffic Light Controller using 8051

  • 8/10/2019 Microprocessor and Microcontroller Labmanual

    3/33

    EXPT NO 1 ARITHMETIC OPERATIONS USING 8085

    AIM:

    To write the assembly language programs for performing the following

    arithmetic operations:a) 16 bit binary addition.

    b) 16 bit binary subtraction.

    c) 16 bit binary multiplication.

    d) 16 bit binary division.

    APPARATUS REQUIRED:

    Microprocessor kit, Power supply.

    PROBLEM STATEMENT:

    Write an ALP in 8085 P to add and subtract two 16-bit binary numbers stored

    in the memory locations 4100 & 4101 and 4102 & 4103 and store the result starting

    from the memory location 4105H. Also provide an instruction in the above program to

    observe the carry also and store the carry in the memory location 4104H.

    ALGORITHM:

    16 BIT ADDITION:

    1 Start.

    1. Enter the two 16 bit data in two register pairs HL and DE.

    2. Initialize a carry counter register B to zero.

    3. Add the contents of register pairs.

    4. If a carry is generated, increment the carry counter B.

    5. Store the Carry in the B register and the sum, which is in the register pair HL in

    the memory.6. Stop.

  • 8/10/2019 Microprocessor and Microcontroller Labmanual

    4/33

    16 BIT SUBTRACTION:

    1. Start.

    2. Get the two 16 bit data in two of the register pairs.

    3. Subtract the Low Order Byte of data1 from that of the data 2.4. Subtract the How Order Byte of data1 along with borrow from that of the data2.

    5. Store the result in memory.

    6. Stop.

    PROBLEM STATEMENT:

    Write an ALP in 8085 P to multiply two 16-bit binary numbers stored in the

    memory locations 4100(LOB) & 4101(HOB) and 4102(LOB) & 4103(HOB) and store

    the result in the memory location 4104H & 4105H.Write instructions for performing

    16-bit division also.

    16 BIT MULTIPLICATION.

    1. Start.

    2. Initialize BC register pair to store the Carry.

    3. Store the data 1 and data 2 in DE register pair and SP register.

    4. Initialize the HL register pair to zero, to store the result.

    5. Multiply by repeated addition of data 1 data 2 times.

    6. If carry flag is set during addition., increment the carry register pair.

    7. Store the product available in HL pair in memory.

    8. Store the contents of the BC register pair which is the carry in memory.

    9. Stop.

    16 - BIT DIVISION

    1. Start.

    1. Store the dividend in HL register pair.

    2. Store the divisor in BC register pair

    3. Initialize the DE register pair to zero, to carry the quotient.

    4. Perform repeated subtraction of divisor from dividend till the dividend is less

    than the divisor.

    5. For every subtraction done, keep on incrementing the quotient register pair DE.

    6. Store the remainder pair in memory.

    7. Store the quotient in memory.

  • 8/10/2019 Microprocessor and Microcontroller Labmanual

    5/33

    8. Stop.

    FLOW CHART

    16-BIT ADDITION 16-BIT SUBTRACTION

    START

    INITIALISECARRY REGISTER

    LOAD TWO NOS. INREGISTER PAIRS

    ADD THE TWONUMBERS

    ANYCARRY

    INCREMENT

    CARRYREGISTER

    STORE THERESULT

    STOP

    NO

    YES

    START

    LOAD THE TWONUMBERS

    INTIALIZE BORROWREGISTER

    SUBTRACT THETWO NUMBERS

    ANYBORROW?

    INCREMENTCARRY

    REGISTER

    STORE THERESULT

    STOP

    NO

    YES

  • 8/10/2019 Microprocessor and Microcontroller Labmanual

    6/33

    16-BIT MULTIPLICATION 16-BIT DIVISION

    START

    GET MULTIPLIER ANDMULTIPLICAND INREGISTER PAIRS

    PRODUCT=0000

    REG. PAIR = REG. PAIR +MULTIPLICAND

    MULTIPLIER =MULTIPLIER 1

    IS MULTIPLIER= 0?

    NO

    STORE REGISTERPAIR

    YES

    STOP

    START

    LOAD DIVISOR &DIVIDEND

    QUOTIENT = 0

    DIVIDEND =DIVIDEND DIVISOR

    QUOTIENT =UOTIENT + 1

    ISDIVIDEND