Docsity

microprocessor lab manual, Lab Reports of Microprocessor and Assembly Language Programming

Partial preview of the text

Download microprocessor lab manual and more Lab Reports Microprocessor and Assembly Language Programming in PDF only on Docsity!

MRCET

MICROPROCESSORS AND

MICROCONTROLLERS LAB

MICROPROCESSORS & MICROCONTROLLERS

LAB MANUAL

B.TECH

(III YEAR – II SEM)

Prepared by:

Mr. KDK Ajay, Asst. Professor

Department of Electronics and Communication Engineering

MALLA REDDY COLLEGE OF ENGINEERING & TECHNOLOGY

(Autonomous Institution – UGC, Govt. of India)

Recognized under 2(f) and 12 (B) of UGC ACT 1956 (Affiliated to JNTUH, Hyderabad, Approved by AICTE - Accredited by NBA & NAAC – ‘A’ Grade - ISO 9001: Certified) Maisammaguda, Dhulapally (Post Via. Kompally), Secunderabad – 500100, Telangana State, India

PROGRAMME EDUCATIONAL OBJECTIVES (PEOs)

PEO1: PROFESSIONALISM & CITIZENSHIP

To create and sustain a community of learning in which students acquire knowledge and learn to apply it professionally with due consideration for ethical, ecological and economic issues.

PEO2: TECHNICAL ACCOMPLISHMENTS

To provide knowledge based services to satisfy the needs of society and the industry by providing hands on experience in various technologies in core field.

PEO3: INVENTION, INNOVATION AND CREATIVITY

To make the students to design, experiment, analyze, interpret in the core field with the help of other multi disciplinary concepts wherever applicable.

PEO4: PROFESSIONAL DEVELOPMENT

To educate the students to disseminate research findings with good soft skills and become a successful entrepreneur.

PEO5: HUMAN RESOURCE DEVELOPMENT

To graduate the students in building national capabilities in technology, education and research.

PROGRAMME SPECIFIC OBJECTIVES (PSOs)

PSO

To develop a student community who acquire knowledge by ethical learning and fulfill the societal and industry needs in various technologies of core field.

PSO

To nurture the students in designing, analyzing and interpreting required in research and development with exposure in multi disciplinary technologies in order to mould them as successful industry ready engineers/entrepreneurs

PSO

To empower students with all round capabilities who will be useful in making nation strong in technology, education and research domains.

PROGRAM OUTCOMES (POs)

Engineering Graduates will be able to:

  1. Engineering knowledge : Apply the knowledge of mathematics, science, engineering fundamentals, and an engineering specialization to the solution of complex engineering problems.
  2. Problem analysis : Identify, formulate, review research literature, and analyze complex engineering problems reaching substantiated conclusions using first principles of mathematics, natural sciences, and engineering sciences.
  3. Design / development of solutions : Design solutions for complex engineering problems and design system components or processes that meet the specified needs with appropriate consideration for the public health and safety, and the cultural, societal, and environmental considerations.
  4. Conduct investigations of complex problems : Use research-based knowledge and research methods including design of experiments, analysis and interpretation of data, and synthesis of the information to provide valid conclusions.
  5. Modern tool usage : Create, select, and apply appropriate techniques, resources, and modern engineering and IT tools including prediction and modeling to complex engineering activities with an understanding of the limitations.
  6. The engineer and society : Apply reasoning informed by the contextual knowledge to assess societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional engineering practice.
  7. Environment and sustainability : Understand the impact of the professional engineering solutions in societal and environmental contexts, and demonstrate the knowledge of, and need for sustainable development.
  8. Ethics : Apply ethical principles and commit to professional ethics and responsibilities and norms of the engineering practice.
  9. Individual and team work : Function effectively as an individual, and as a member or leader in diverse teams, and in multidisciplinary settings.
  10. Communication : Communicate effectively on complex engineering activities with the engineering community and with society at large, such as, being able to comprehend and write effective reports and design documentation, make effective presentations, and give and receive clear instructions.
  11. Project management and finance : Demonstrate knowledge and understanding of the engineering and management principles and apply these to one’s own work, as a member and leader in a team, to manage projects and in multi disciplinary environments.
  12. Life- long learning : Recognize the need for, and have the preparation and ability to engage in independent and life-long learning in the broadest context of technological change.

LABORATORY RULES

General Rules of Conduct in Laboratories:

  1. You are expected to arrive on time and not depart before the end of a laboratory.
  2. You must not enter a lab unless you have permission from a technician or lecturer.
  3. You are expected to comply with instructions, written or oral, that the laboratory Instructor gives you during the laboratory session.
  4. You should behave in an orderly fashion always in the lab.
  5. You must not stand on the stools or benches in the laboratory.
  6. Keep the workbench tidy and do not place coats and bags on the benches.
  7. You must ensure that at the end of the laboratory session all equipment used is stored away where you found it.
  8. You must put all rubbish such as paper outside in the corridor bins. Broken components should be returned to the lab technician for safe disposal.
  9. You must not remove test equipment, test leads or power cables from any lab without permission.
  10. Eating, smoking and drinking in the laboratories are forbidden.
  11. The use of mobile phones during laboratory sessions is forbidden.
  12. The use of email or messaging software for personal communications during laboratory sessions is forbidden.
  13. Playing computer games in laboratories is forbidden.

Specific Safety Rules for Laboratories:

  1. You must not damage or tamper with the equipment or leads.
  2. You should inspect laboratory equipment for visible damage before using it. If there is a problem with a piece of equipment, report it to the technician or lecturer. DONOT return equipment to a storage area
  3. You should not work on circuits where the supply voltage exceeds 40 volts without very specific approval from your lab supervisor. If you need to work on such circuits, you should contact your supervisor for approval and instruction on how to do this safely before commencing the work.
  4. Always use an appropriate stand for holding your soldering iron.
  5. Turn off your soldering iron if it is unlikely to be used for more than 10 minutes.
  6. Never leave a hot soldering iron unattended.
  7. Never touch a soldering iron element or bit unless the iron has been disconnected from the mains and has had adequate time to cool down.
  8. Never strip insulation from a wire with your teeth or a knife, always use an appropriate wire stripping tool.
  9. Shield wire with your hands when cutting it with a pliers to prevent bits of wire flying about the bench.

INDEX

    1. Introduction to MASM PART-A
    1. 16 - bit Arithmetic Operations
    1. Sorting of Array for
    1. Searching for Character in a String
    1. Sting Manipulations for
    1. Introduction to Hardware experiments PART-B
    1. Digital Clock Design using
    1. Interfacing ADC&DAC to
    1. Parallel Communication between Two Microprocessors using
    1. Interfacing stepper to
    1. Arithmetic, Logical and Bit Manipulation Instructions of
    1. Timer/Counters in
    1. Interrupt Handling in
    1. UART Operation in
    1. Interfacing LCD to
    1. Interfacing Matrix keyboard to

be reloadable because it can be put anywhere in memory to be run. In MASM/TASM, LINK/TLIN8K source filename is used to link the file.

DEBUGGER

A debugger is a program which allows you to load your object code program into system memory, execute the program and troubleshoot are debug it the debugger allows you to look at the contents of registers and memory locations after your program runs. It allows you to change the contents of register and memory locations after your program runs. It allows you to change the contents of register and memory locations and return the program. A debugger also allows you to set a break point at any point in the program. If you inset a breakpoint the debugger will run the program up to the instruction where the breakpoint is set and stop execution. You can then examine register and memory contents to see whether the results are correct at that point. In MASM/TASM, td filename is issued to debug the file.

DEBUGGER FUNCTIONS:

  1. Debugger allows looking at the contents of registers and memory locations.
  2. We can extend 8-bit register to 16 - bit register which the help of extended registeroption.
  3. Debugger allows setting breakpoints at any point with the program.
  4. The debugger will run the program up to the instruction where the breakpoint is set and then stop execution of program. At this point, we can examine registry and memory contents at that point.
  5. With the help of dump we can view register contents.
  6. We can trace the program step by step with the help of F7.
  7. We can execute the program completely at a time using F

The DOS - Debugger:

The DOS “Debug” program is an example of simple debugger that comes with MS-DOS. Hence it is available on any PC .it was initially designed to give the user the capability to trace logical errors in executable file.

Below, are summarized the basic DOS - Debugger commands

COMMAND SYNTAX

Assemble A [address] Compare C range address Dump D [range] Enter E address [list] Fill F range list Go G [=address] [addresses] Hex H value1 value Input I port Load L[address] [drive][first sector][number] Move M range address Name N[pathname][argument list] Output O port byte Proceed P [=address][number] Quit Q Register R[register] Search S range list Trace T [=address][value] Unassembled u [range] Write W[address][drive][first sector][number]

MS-MASM:

Microsoft’s Macro Assembler (MASM) is an integrated software package Written by Microsoft Corporation for professional software developers. It consists of an editor, an assembler, a linker and a debugger (Code View). The programmer’s workbench combines these four parts into a user-friendly programming environment with built in on line help. The following are the steps used if you are to run MASM from DOS

If there are any errors in the program assembler reports all of them at the command prompt with line no’s, if there are now bugs your ready to link the program. To link the program type the following line at command prompt Link program name ,,,,, (5 commas) Example: Link add,,,,, OR Example: link add.obj After linking you are ready to execute the program. To execute the program type the following command Debug program name.exe hit the enter Example: Debug add.exe Now you entered into the execution part of the program here you have to execute the program instruction by instruction (debugging) first of all press the r key(register) hit the enter key it’ll displays all the registers and their initial values in HEXDECIMAL note down the values of all the register which are used in the program. To execute the next instruction press t key (TRACE) hit the enter it’ll execute that instruction and displays the contents of all the register. You have to do this until you reach the last instruction of the program. After execution you have to observe the results (in memory or registers based on what you have written in the program).

STEP6: Copying list file (common for all programs):

A list file contains your code starting address and end address along with your program .For every program assembler generates a list file at your folder, programname.lst (ex. Add.lst) you should copy this to your lab observation Opening a list file Edit programname.lst Example. Edit add.lst

START INITIALIZATION OF DATA & EXTRA SEGMENT AXOPR STOP AXAX+OPR SUMAX

EXPERIMENT NO.

16 BIT ARITHMETIC OPERATIONS

AIM : Write an ALP to 8086 to perform 16 - bit arithmetic operations in various Addressing Modes TOOLS: PC installed with MASM ALGORITHM: Step I : Initialize the Data segment memory. Step II : Initialize the Extra segment memory. Step III : Load the first number into AX register. Step IV : Add two numbers. Step V : Store the result in Extra segment. Step VI : Terminate the program Step VII : Stop.

FLOW CHART:

STOP AXAX-OPR DIFFAX AXOPR

FLOW CHART:

PROGRAM:

ASSUME CS:CODE, DS: DATA,ES:EXTRA
DATA SEGMENT
OPR1 DW 5169H
OPR2 DW 1000H
DATA ENDS
EXTRA SEGMENT
DIFF DW?
EXTRA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX ; REGISTER ADDRESIING MODE
MOV AX, EXTRA
MOV ES, AX ; REGISTER ADDRESIING MODE
MOV BX, OFFSET OPR1 ; DIRECT ADDRESSING MODE
MOV AX, [BX] ; BASE ADDRESSING MODE/
SUB AX, OPR2 ; DIRECT ADDRESSING MODE
MOV DIFF, AX ; DIRECT ADDRESSING MODE
INT 03H
CODE ENDS
END START
END

START INITIALIZATION OF DATA SEGMENT

START INITIALIZATION OF DATA & EXTRASEGMENT MULTIPLY THE TWO NUMBERS & STORE THE RESULT IN EXTRA SEGMENT STOP AXOPR BXOPR (C) 16 - bit Multiplication using different addressing modes

ALGORITHM:

Step I : Initialize the data & extra segment memory. Step II : Load the first number into AX register. Step III : Load the second number into BX register. Step IV : Multiply AX with BX. Step V : store lower word in accumulator into extra segment. Step VI : Store Upper word in DX register into extra segment Step VII : Verify the result. Step VIII : Stop.

FLOW CHART:

START

INITIALIZATION OF DATA &EXTRA SEGMENT STORE THE RESULT INTO THE EXTRA SEGMENT

STOP

LOAD THE NUMBERS INTO RESPECTIVE REGISTERS DIVISION OF DX:AX BY BX

(D) 16 - bit Division using different addressing modes

ALGORITHM:

Step I : Initialize the data & extra segment memory. Step II : Load the first number into DX:AX registerpair. Step III : Load the second number into BX register. Step IV : Divide DX:AX pair by BX. Step V : store the Quotient in AX register into extra segment. Step VI : Store the reminder in DX register into extra segment. Step VII : Verify the result. Step VIII : Stop.

FLOW CHART:

PROGRAM:

ASSUME CS: CODE, DS:DATA, ES:EXTRA
DATA SEGMENT
OPR1 DD 74105169H
OPR2 DW 7875H
DATA ENDS
EXTRA SEGMENT
DIVQ DW?
DIVR DW?
EXTRA ENDS
CODE SEGMENT
START:MOV AX, DATA
MOV DS, AX ; REGISTER ADDRESIING MODE
MOV AX, EXTRA
MOV ES, AX ; REGISTER ADDRESIING MODE
MOV SI, OFFSET OPR
MOV AX, [SI] ; INDEXED ADDRESSING MODE/
MOV DX, [SI+2] ; INDEXED ADDRESSING MODE
MOV BX, OPR2 ; DIRECT ADDRESSING MODE
DIV BX ; REGISTER ADDRESSING MODE
MOV DIVQ , AX
MOV DIVR , DX
INT 03H
CODE ENDS
END START
END