MicroProcessor Labs

Embed Size (px)

Citation preview

  • 7/28/2019 MicroProcessor Labs

    1/12

    Microprocessor Based Systems (CS-305) 2010-2014

    ELECTRICAL ENGINEERING, UCET, IUB Page 1

    Sr. # LAB Experiments Index PAGE

    01 Introduction to Microcomputer and Operating Systems 2

    02 Interacting with debug utility in Windows environment 4

    03

    Basic Arithmetic Operations of 8086/8088

    Microprocessor in Debug Mode 7

    04

    05

    06

    07

    08

    09

    10

    11

    12

  • 7/28/2019 MicroProcessor Labs

    2/12

    Microprocessor Based Systems (CS-305) 2010-2014

    ELECTRICAL ENGINEERING, UCET, IUB Page 2

    LAB EXPERIMENT # 01

    Introduction to Microcomputer & Operating Systems

    1)OBJECTIVE:The objective of this experiment is to introduce the operating systems and different

    hardware components of a microcomputer.

    2)REQUIREMENTS: Standalone Personal Computer Operating system ( 32-bit windows XP/7, 64-bit windows with XP Mode)3)INTRODUCTION:

    Microcomputer (PC) operating systems are briefly discussed in this experiment.

    The two commonly used operating systems in PC are MS-DOS and Windows (95, 98,etc). In

    the MS-DOS environment, command line is used to view, copy or interact with stored files. In

    Windows environment, clicking the mouse performs these operations in a user friendly manner.

    First part of this experiment introduces the file management in MS DOS mode. In the second

    part a 386 microcomputer is disassembled and its hardware components are identified. Finally

    the PC is reassembled in the laboratory.

    4)PRE-LAB:Use any computer with 'Windows', to do the following operations:

    1) In Windows operating system, use 'Start' and 'Find' menu to locate the 'Debug'program. Note the address or path.

    2) From 'Start' and 'Programs' menu, use 'Windows Explorer' to make a newdirectory in C drive and name it 'MP'.

    3) Using 'Copy' and 'Paste' command of 'Windows Explorer' copy the 'Debug.exe'program in to the newly created directory of 'MP'

    4) Execute the 'Debug' program by clicking on it. (type 'q' to quit)5) Also execute the 'Debug' program, from 'Start' and 'Run' menu.6) From 'Start' and 'Programs' menu, click on 'MS-DOS prompt' to start the MS-DOS

    debugger. Type 'Debug' and press to execute the program. Type 'q' to quit the

    debug program.

    Student Name: -------------------------------------------------- Roll No: ---------------------

    Lab Instructor Signature: ------------------------------------ Date: ------------------------

  • 7/28/2019 MicroProcessor Labs

    3/12

    Microprocessor Based Systems (CS-305) 2010-2014

    ELECTRICAL ENGINEERING, UCET, IUB Page 3

    5)LAB WORK:Use the Lab microcomputer to perform the following operations;

    i. In MS-DOS mode, C :\>' means we are in the main directory. Go to this directory anduse 'DIR' to check the contents of the directory.

    ii. Use 'CD' or change directory command to go to 'DOS' directory.iii. Use 'DIR' to find Debug program in this directory (type 'DIR D* ')

  • 7/28/2019 MicroProcessor Labs

    4/12

    Microprocessor Based Systems (CS-305) 2010-2014

    ELECTRICAL ENGINEERING, UCET, IUB Page 4

    LAB EXPERIMENT # 02

    Interacting with Microprocessor using Debug Utility

    1)OBJECTIVE:To become familiar with Debug modes or commands

    2)REQUIREMENTS: Standalone Personal Computer Operating system ( 32-bit windows XP/7, 64-bit windows with XP Mode)3)THEORY:

    Microprocessor is the main part of the CPU. It contains all the processing parts of

    a system like RAM, ROM, BIOS, CACHE, MEMORY ADRESSES, CACHES, REGISTERS

    etc. debugging utility in command prompt is the process in which we saw the location of

    different registers like AX, BX by using different commands. We can also move data to registernow we briefly explore some different command

    R-command:R command is used to show the different types of registers on your

    microprocessor.

    -rax (shows the register)

    AX 0000

    : 12ab (Assign this value to above register)

    D-command :Display command is used to display memory contents.

    -d 0000 (show memory contents)

    -d 0000 0000f (show aparticular location at f)

    F-command:Fill command is used to fill the desired memory location

    -F 0000 0000 3C (To see the full memory location)

    -d 0000 0000

    0B2B:0000 3C

    Student Name: -------------------------------------------------- Roll No: ---------------------

    Lab Instructor Signature: ------------------------------------ Date: ------------------------

  • 7/28/2019 MicroProcessor Labs

    5/12

    Microprocessor Based Systems (CS-305) 2010-2014

    ELECTRICAL ENGINEERING, UCET, IUB Page 5

    Mov-command:Mov command is basically use to assign a value from one register

    to another register or we can say source to destination.

    Syntax: MOV ax, 5

    This means that we assign value 5 to the register ax.

    Trace command:Trace command is used to execute your program state by state.

    Syntax: -t

  • 7/28/2019 MicroProcessor Labs

    6/12

    Microprocessor Based Systems (CS-305) 2010-2014

    ELECTRICAL ENGINEERING, UCET, IUB Page 6

    4)PROCEDURE: Go to the start menu and open the command prompt. Write debug on the window now we are working in debug utility mode. Write r command t see the registers. Write d command to display memory contents. Write f command to fill the desired memory location. Terminate the program by using interrupt command.5)CONCLUSION:

    In this lab we learn how to use debug utility and functions of r, d and f commands.

    6)REVIEW QUESTION:

    Q.1: What is Debug utility?

    Q.2: How to access and change the contents of a general purpose register?

    Q.3: What is the command to view to view a specific memory location?

    Q.4: What command is used to fill a memory location?

    Q.5: How is a program executed in debug utility?

  • 7/28/2019 MicroProcessor Labs

    7/12

    Microprocessor Based Systems (CS-305) 2010-2014

    ELECTRICAL ENGINEERING, UCET, IUB Page 7

    LAB EXPERIMENT # 03

    Basic Arithmetic & Logic Operations in Debug Utility

    1)OBJECTIVE:Basic arithmetic operation on 8086 microprocessor by using Debug environment

    2)REQUIREMENTS: Standalone Personal Computer Operating system ( 32-bit windows XP/7, 64-bit windows with XP Mode)

    3)THEORY:There are two types of common instructions which are used in the microprocessor

    in debug environment.

    I. BASIC ARITHMATIC OPERAITONS: ADD instruction SUB instruction

    Add instruction:Add instruction is used to add source operand on which

    operation is performed to a destination operand and sum as stored in the

    destination.

    Program:

    a 0100

    Mov ax,2345 % assign value to register ax

    mov bx,5670 % assign value to bx

    add ax,bx % add operation on ax,bx

    mov [0130],ax % save the value of ax on the given memory location

    int 20h % terminate the program

    ctr+c % come out from the program

    -t % trace the program state by state

    Student Name: -------------------------------------------------- Roll No: ---------------------

    Lab Instructor Signature: ------------------------------------ Date: ------------------------

  • 7/28/2019 MicroProcessor Labs

    8/12

    Microprocessor Based Systems (CS-305) 2010-2014

    ELECTRICAL ENGINEERING, UCET, IUB Page 8

    Sub instruction:Sub instruction is used to subtract source operand (on which

    operation is performed to a destination operand and result is stored to

    destination.

    a 0100

    mov ax,2345 % assign value to register ax

    mov bx,5670 % assign value to bxsub ax,bx % subtraction between ax,bx

    mov [0130],ax % save the value of ax on the given memory location

    int 20h % terminate the program

    ctr+c % come out from the program

    -t % trace the program state by state

  • 7/28/2019 MicroProcessor Labs

    9/12

    Microprocessor Based Systems (CS-305) 2010-2014

    ELECTRICAL ENGINEERING, UCET, IUB Page 9

    In the same manner uset (Trace) command to run the program step by step and the enter d

    0120 0121 to display the output saved in memory location.

    I. BASIC LOGIC OPERAITONS: AND Operation OR Operation NOT Operation AND Operation:

    AND instruction is used to perform AND operation on each bit on the destination operand with

    the corresponding bit in the source operand.

    The symbol of AND operation is given

    Truth table for AND operation

    To run this program use Trace command and finally d 0120 0121 command to display the

    output saved in memory. OR Operation:

    OR instruction is used to perform OR operation on each bit on the destination operand with

    the corresponding bit in the source operand.

    x y F=xy

    0 0 0

    0 1 0

    1 0 0

    1 1 1

  • 7/28/2019 MicroProcessor Labs

    10/12

    Microprocessor Based Systems (CS-305) 2010-2014

    ELECTRICAL ENGINEERING, UCET, IUB Page 10

    The symbol for OR operation is given by

    Truth table for OR operation

    To run this program use Trace command and finally d 0120 0121

    command to display the output saved in memory.

    NOT Operation:Not instruction is the logic compliment of all the bits saved in a register.

    The symbol for NOT operation is given by

    Truth table for NOT operation

    x y F=x+y

    0 0 0

    0 1 1

    1 0 1

    1 1 1

    x F

    0 1

    1 0

  • 7/28/2019 MicroProcessor Labs

    11/12

    Microprocessor Based Systems (CS-305) 2010-2014

    ELECTRICAL ENGINEERING, UCET, IUB Page 11

    4)PROCEDURE: Go to the start menu and open the command prompt. Write debug on the window now we are working in debug utility mode. Open the register 'a' and write your program. First write the program for adding the values of two registers. Second write the program to subtract the values of two register. Now we move data towards our desired memory location. We check our program state by state by using t command.5)CONCLUSION:

    In this Lab we learned basic commands for interacting with Microprocessors

    Registers and Primary memory. We viewed and changed the contents of differentregisters and Memory cells.

    6)REVIEW QUESTIONS:Q.1: What is mov instruction?

    Q.2: How to run debug utility in Windows environment?

    Q.3: What is immediate addressing mode?

  • 7/28/2019 MicroProcessor Labs

    12/12

    Microprocessor Based Systems (CS-305) 2010-2014

    ELECTRICAL ENGINEERING, UCET, IUB Page 12

    Q.4: How to mov data to two general purpose register and add their contents using

    immediate addressing mode?

    Q.5: What is the use of int 20h command?