+ All Categories
Home > Documents > Date: Date

Date: Date

Date post: 08-Jan-2023
Category:
Upload: independent
View: 0 times
Download: 0 times
Share this document with a friend
28
MGM COLLEGE OF ENGINEERING AND TECHNOLOGY KAMOTHE, NAVI-MUMBAI-410209 DEPARTMENT OF COMPUTER ENGINEERING Laboratory Manual Microprocessor Prepared By Approved by (Ekta sarda) (V BALACHANDRAN) Professor HOD Date: Date:
Transcript

MGM COLLEGE OF ENGINEERING AND TECHNOLOGY

KAMOTHE, NAVI-MUMBAI-410209

DEPARTMENT OF COMPUTER ENGINEERING

Laboratory Manual

Microprocessor

Prepared By Approved by

(Ekta sarda) (V BALACHANDRAN)

Professor HOD

Date: Date:

Docu ment No.:- CE/MP

Version No.:-

Index

H/W

Requirements

Microsoft window XP, 2GB of Ram. Processor.

S/W

Requirements

MASM(Microsoft Macro Assembler).

Experiment No 1

Aim

To study about 8085 & 8086 Microprocessor.

Sr.No. Experiments Page No.

1 To study 8085 microprocessor kit

2 WAP for the addition of an 8 bit numbers

3 WAP to find out number of even and odd from a given series of 16 bit hexadecimal.

4 To perform packed and unpacked BCD addition.

5 WAP to find out product of two 8 bit numbers.

6WAP to find square root of two digit number and assume that number is perfect square.

7 Implement the program to Display message on CRT.

8Implement the program for changing the sequence of 2 bytes number from ascending to descending.

9 Implement the program to search number in an array.

10Implement the program to findthe number is palindrome or not.

Theory

8085 and 8086 INSTRUCTION SET

The mnemonics assigned to the instructions are designed to indicate the function of the instruction. The instructions fall into the following functional categories:

1. Data Transfer Croup:

The data transfer instructions move data between registers or between memory and registers. MOV MoveMVI Move ImmediateLDA Load Accumulator Directly from MemorySTA Store Accumulator Directly in MemoryLHLD Load H & L Registers Directly from MemorySHLD Store H & L Registers Directly in Memory 

An 'X' in the name of a data transfer instruction implies that it deals with a register pair (16-bits); 

LXI Load Register Pair with Immediate dataLDAX Load Accumulator from Address in Register PairSTAX Store Accumulator in Address in Register PairXCHG Exchange H & L with D & EXTHL Exchange Top of Stack with H & L 

2. Arithmetic Group:

The arithmetic instructions add, subtract, increment, or decrement data in registers or memory. ADD Add to AccumulatorADI Add Immediate Data to AccumulatorADC Add to Accumulator Using Carry Flag

ACI Add Immediate data to Accumulator Using Carry SUB Subtract from AccumulatorSUI Subtract Immediate Data from AccumulatorSBB Subtract from Accumulator Using Borrow (Carry) FlagSBI Subtract Immediate from Accumulator Using Borrow (Carry)

FlagINR Increment Specified Byte by OneDCR Decrement Specified Byte by OneINX Increment Register Pair by OneDCX Decrement Register Pair by OneDAD Double Register Add; Add Content of Register

Pair to H & L Register Pair 3. Logical Group:

This group performs logical (Boolean) operations on data in registers and memory and on condition flags. The logical AND, OR, and Exclusive OR instructions enable you to set specific bits in the accumulator ON or OFF.

 ANA Logical AND with AccumulatorANI Logical AND with Accumulator Using Immediate DataORA Logical OR with AccumulatorOR Logical OR with Accumulator Using Immediate DataXRA Exclusive Logical OR with AccumulatorXRI Exclusive OR Using Immediate Data 

The Compare instructions compare the content of an 8-bit value with the contents of the accumulator;

CMP CompareCPI Compare Using Immediate Data 

The rotate instructions shift the contents of the accumulator one bit position to the left or right: 

RLC Rotate Accumulator Left

RRC Rotate Accumulator RightRAL Rotate Left Through CarryRAR Rotate Right Through Carry Complement and carry flag instructions: 

CMA Complement AccumulatorCMC Complement Carry FlagSTC Set Carry Flag 

4.. Branch Group:The branching instructions alter normal sequential program flow, either unconditionally or conditionally. The unconditional branching instructions are as follows: JMP JumpCALL CallRET Return 

Conditional branching instructions examine the status of one of four condition flags to determine whether the specified branch is to be executed. The conditions that may be specified are as follows: NZ Not Zero (Z =0)Z Zero (Z = 1)NC No Carry (C =0)C Carry (C = 1)PO Parity Odd (P= 0)PE Parity Even (P= 1)P Plus (S = 0)M Minus (S = 1) 

Thus, the conditional branching instructions are specified as follows: Jumps Calls ReturnsC CC RC (Carry)

INC CNC RNC (No Carry)JZ CZ RZ (Zero)JNZ CNZ RNZ (Not Zero)JP CP RP (Plus)JM CM RM (Minus)JPE CPE RPE (Parity Even)JP0 CPO RPO (Parity Odd) 

Two other instructions can affect a branch by replacing the contents or theprogram counter: PCHL Move H & L to Program CounterRST Special Restart Instruction Used with Interrupts 

5. Stack I/O, and Machine Control Instructions:

The following instructions affect the Stack and/or Stack Pointer: 

PUSH Push Two bytes of Data onto the StackPOP Pop Two Bytes of Data off the StackXTHL Exchange Top of Stack with H & LSPHL Move content of H & L to Stack Pointer 

The I/0 instructions are as follows:

IN Initiate Input OperationOUT Initiate Output Operation 

The Machine Control instructions are as follows:EI Enable Interrupt SystemDI Disable Interrupt SystemHLT HaltNOP No Operation

Procedure for execute the Assembly program using MASM

Assembly language programs are converted into executable machine codeby a utility program referred to as an assembler, the conversionprocess being referred to as assembly or assembling the program.

Assembly language (sometimes abbreviated as ASM, usually as the fileextension for a text file which is used as a code for a programwritten in Assembly language, or in the names of assemblers, likeFASM, MASM, NASM and TASM) is a low-level programming language forcomputers, microprocessors, microcontrollers, and other programmabledevices in which each statement corresponds to a single machinelanguage instruction. An assembly language is specific to a certaincomputer architecture, in contrast to most high-level programminglanguages, which generally are portable to multiple systems.

What is MASM assembler?

The Microsoft Macro Assembler (MASM) is an x86 assembler that uses theIntel syntax for MS-DOS and Microsoft Windows. Beginning with MASM 8.0there are two versions of the assembler - one for 16-bit and 32-bitassembly sources, and another (ML64) for 64-bit sources only.

Assembling and Running Assembly Language Programs

An assembly language program must be assembled and linked before it can beexecuted.The assembler produces an object file (extension .OBJ). This file is takenby the linker and an executable program (extension .EXE) is produced, assuming there were noerrors in the program. We use the MASM assembler and the LINK linker. These are availableon NAL under Programming:“MASM filesv 5.0”.

When saving the file with Notepad, you MUST save it with the “File Type”set to “All Files”.You should now select the MS-DOS Prompt (Command PROMPT) from the Startbutton menu (sometimes under Programs option)

To do assembly language programming MASM assembler you can follow these steps:

1.) Install software MASM 6.15 on your PC. (You can find this in our download section)

2.) Use NOTEPAD as text editor. (You can use any text editor also such as- notepad++,dos editor etc.)

3.) Type your assembly code on text editor and save it with file extension.asm

for example:-type following code and save with file name test.asm

4.) To assemble the program use command: C :\> masm test (note:-here we assume that the program is saved in c:\ drive, in other caseyou have to specify the full path of your program location.)

5.) For linking the object file created after assembling use command:

C:\>tlink filename.obj.

Microsoft (R) Overlay Linker Version 3.64

Copyright (C) Microsoft Corp 1983-1988. All rights reserved.

Run File [C: TEST.EXE]: Press Return

List File [NUL.MAP]: Press Return

Libraries [.LIB]: Press Return

6.) To run your program, simply enter its name:

C:\> tb filename.exe

X

In the event of errors, you must edit your program and correct the errors. Then you repeat the above steps to assemble and link your program, before running it.

Similarly, if you modify your program, you must assemble and link it beforerunning it again.

Experiment No:-2

Aim:-WAP for the addition of an 8 bit numbers.

Theory:- In this program we show the addition of 100(D) numbers.Initially the resulting sum of the first two numbers will beseparated till all the number in the series is added. Aconditional jump instruction will be used to implement thecounter, checking logic of the comments and it explains thepurpose of each instruction.

Algorithm:-

1.Start

2.Initialise the data segment COUNT.

3.Number of bytes to be added in CX register.

4.Clear the bit for converting the byte to word.

5.Point to the first number in this list.

6.Take the first number in BL, BH is zero add AX with

BX.

7.Increment pointer to the byte list decrement counter.

Flow Chart:-

Conclusion:-

Thus the addition of series of an 8 bit number is done successfully.

Result:-

START

GET THE FIRST NUMBER

GET THE SECOND NUMBER

ADD THE TWO NUMERS

STOP

Experiment No:-3

Aim: - WAP to find out number of even and odd from a given seriesof 16 bit hexadecimal.

Algorithm:-

1.Initialise data segment.

2.Initialise the printer.

3.Initialise the counter.

4.Get the number if bit is zero then even number.

5.Increment pointer.

6.Decrement pointer.

7.Check if count =0 if not go to step 4.

8.Store check.

9.Stop

Conclusion:-

Thus we have studied how to find out number of even and odd number from a given series of 16 bit hexadecimal.

Result:-

Experiment No:-4

Aim: - To performs packed and unpacked BCD addition.

Theory:-

For packed BCD addition:-

Pack the two BCD number stored in memory location 2200H and

2201H. Assume the least significant digit is stored at 2200H.

For unpacked BCD number:-

Two digits BCD number is stored in memory locations 2200H.

Unpack the BCD number and store the two digits in memory

locations 2300H and 2301H such that memory locations 2300H will

have lower BCD digit.

Algorithm:-

For packed BCD number:-

1. Start

2. Get the number for the most significant BCD digit.

3. Rotate the 4 times to the left for adjusting the position.

4. Mark significant digit to zero.

5. Start the partial result.

6. Get the lower BCD digits and add the number for lower significant

BCD digits

7. Store the result.

8. Stop.

For unpacked BCD number:-

1. Start

2. Get the packed BCD number.

3. Mark the lower BCD digit at BCD number.

4. Adjust the higher BCD digit to lower BCD digit using rotate.

5. Store the partial result and get original BCD number.

6. Mark the higher nibbles at cut the BCD digits and store the result.

7. Stop.

Conclusion :- Thus we have performed packed and unpacked BCD numbers.

Results:-

Experiment No:-5

Aim: - WAP to find out product of two 8 bit numbers.

Theory:-

In this program multiplication of two 8 bit numbers is performed. The elements are multiplied to get the desired result.

Algorithm:-

1. Initialize the data segment.

2. Get the first number in the register.

3. Multiply AX with BX.

4. Increment and decrement counter.

5. If multiplied, store result.

6. Stop.

Flowchart:- START

MOVE DATA

GET THE FIRST NUMBER INAX REG

MULTIPLY AX WITH BX

Conclusion:-

Thus the product of two 8 bit numbers is been performed.

Result:-

STORE RESULT

STOP

Experiment No:-6

Aim: - WAP to find square root of two digit number and assume that number is perfect square.

Theory:-

In this program we have to find square root or given digits. Here we have to consider the number given to us asa perfect square.

EX:-The square root of 64 is given 8.

Algorithm:-

1. Start

2. Initialise the data segment.

3. Initialise BL to 1 and AL100.

4. Check for zero numbers.

5. If zero then go to result.

6. If not zero sub BL from CL.

7. Increment the pointer.

8. Store the result.

9. Stop.

Conclusion:-

Thus we have studied how to find square root of two digit number and assume that number is perfect square.

Result:-

Experiment No: 7

Aim: Implement the program to Display message on CRT.

Theory:-In the data segment the message is written in the form of message characters and cursor control characters. The $ is the termination character at the end of every message to be displayed. The register AH is loaded for displaying register on the CRT system.

Algorithm:

1. Start

2. Initialise DS.

3. Set function value for display

4. Point to message and run

5. Return

6. Stop

Conclusion:

Thus we have performed displaying the given message on CRT.

Result:-

Experiment No: 8

Aim: Implement the program for changing the sequence of 2 bytes number from ascending to descending.

Theory:-

The program is written using just data transfer instruction. Here we have used stack to change order of data words. It is a common practise to push all registers to at start of subroutine and pop it at the end of subroutine so that original contents are retrieved .The stack mechanism is also used in case of interrupt service routine to store instruction pointer and code segment of return add.

Algorithm:

1. Initialize data segment.

2. Initialize comparison are pass counter.

3. Initialize memory pointer to read number from array.

4. Initialize word counter.

5. Read number from array.

6. Compare two numbers.

7. If numbers > next number, then go to step 9.

8. Swap the numbers.

9. Increment memory pointer to read next number.

10. Decrement comparison counter by 1.

11. If word counter = 0, then go to step 5.

12. Decrement comparison counter by 1.

13. If Comparison counter = 0, then go to step 3

14. Stop.

Conclusion:

Thus we have change the sequence of 2 bytes number from

ascending to descending.

Result:-

Experiment No: 9

Aim: Implement the program to search number in array

Theory:-

The process of finding the number in the array is called as searching. There are two types of searching linear search and binary search. In linear search the element to be found is not searched sequentially instead it is done with the middle element. Thus binary search is the efficient method.

Algorithm:

1. Initialize the data segment.

2. Initialize pointer.

3. Initialize counter.

4. Initialize base pointer for array.

5. Compare number with maximum. If no carry, go to step 7.

6. Save the maximum number.

7. Decrement Counter.

8. Increment pointer.

9. Check if count = 0, If not goto step 5.

10. Store the maximum number.

11. Stop.

Conclusion:-Thus we have searched the number in given array.

Result:-

Experiment No: 10

Aim: Implement the program to find the number is palindrome or not.

Theory:-This program is used to check whether the given string is palindrome or not. Here palindrome means we compare the character sequence from left to right and right to left in whichthey sound same.

Algorithm:

1. Start.

2. Initialize pointer at the start of string.

3. Initialize pointer at the end of string.

4. Initialize counter = length/2.

5. Decrement counter.

6. All Character equal if yes, display the message.

7. Is count = 0 if yes display the message string is palindrome else

Go to step 5.

Conclusion:

Thus we have studied how to perform a palindrome on screen.

APPENDIX: - SYLLABUS

Experiment No: 10

University ofClass: T.E. Branch: Computer

EngineeringSemester: V

Subject: Microprocessor (Abbreviated as MP )Periods per Week

Lecture 04Practical 02Tutorial --

Hours MarksEvaluation System

Theory 03 100Practical -- 25Oral --- --

Term --- 25Total 03 150

Module Content s Hours1 Introduction to Intel 8085 Microprocessor:

Basic functions of the microprocessor,System bus, Architecture, Pin Configuration and Programmer’s model ofIntel 8085 Microprocessor. Overview of the

06

2 Intel 8086 Architecture: Major features of8086 processor, 8086/88 CPU Architecture and the pipelined operation, Programmer’s

04

3 Instruction Set of 8086 andProgramming: Instruction Set of 8086microprocessor in details, Addressingmodes of 8086/88, Programming the

06

4 Designing the 8086 CPU module: 8086 pindescription in details, Generating the8086 System Clock and ResetSignals, 8086 Minimum and MaximumMode CPU Modules, Minimum and MaximumMode Timing Diagrams, Interrupt

06

5 Peripheral Controllers for 8086 familyand System Design: Functional BlockDiagram and description, Control WordFormats, Operating Modes andApplications of the PeripheralController namely 8255-PPI, 8253-PIT,

8259- PIC and 8237-DMAC.

14

6 Multiprocessor Systems:Study of Multiprocessor Configurations namely Tightly Coupled System (TCS) and Loosely Coupled System (LCS), TCS with thecase study of the Coprocessor,

06

7 I/O Buses and Standards:The EIA RS-232C Serial Interface Standard and IEEE-488 GPIB Standard

02

Term work:Term work shall contain minimum 10 experiments (fromthe list given below) and 03 assignments and at leastone term test on the above syllabus. A mini-project based onthe syllabus to be taken by group of students and isdesirable but not mandatory.

(a) Term work and the journal:• Assembly Language Programming based on TASM/MASM- 03 experiments.• Assembly Language Programming using BIOS/DOS interrupts-02 experiments.• Mixed Language Programming- 02 experiments,• Peripheral Interfacing and applications- 05 experiments.

The journal shall also contain at least 03 assignments onthe syllabus/ beyond syllabus. Maximum weight age for thecertified journal = 15 Marks in the Term work.

(b) Term test:Test can be a mid- term test of 50 marks (preferably preliminary examination of 100 marks at the end of the semester).

Maximum weight age for the test = 10 Marks in the Term work.

Practical examination:Practical examination is based on the experiments carriedout in the term work and may contain the other experimentsbased on the concepts. Necessary data sheets/control wordformats will be available to the students at the time of thepractical examination

Oral examination:Oral examination is based on the entire syllabus and may notbe restricted to the practical carried out in the practical examination.

List of reference books:1) Microprocessor architecture and applications with 8085:By Ramesh Gaonkar (Penram International Publication).2) 8086/8088 family: Design Programming and Interfacing: ByJohn Uffenbeck (Pearson Education) .3) 8086 Microprocessor Programming and Interfacing thePC: By Kenneth Ayala4) Microcomputer Systems: 8086/8088 family Architecture, Programming and Design: By Liu & Gibson (PHI Publication).5) Microprocessor and Interfacing: By Douglas Hall(TMH Publication).

Question Bank

1. What is a Microprocessor?

2. What is the difference between 8086 and 8088?

3. What are the functional units in 8086?

4. What are the flags in 8086?

5. What is the Maximum clock frequency in 8086?

6. What are the various segment registers in 8086?

7. Logic calculations are done in which type of registers?

8. How 8086 is faster than 8085?

9. What does EU do?

10. Which Segment is used to store interrupt and subroutine return address registers?

11. What does microprocessor speed depend on?

12. What is the size of data bus and address bus in 8086?

13. What is the maximum memory addressing capability of 8086?

14. What is flag?

15. Which Flags can be set or reset by the programmer and also used to control the operation of the processor?

16. In how many modes 8086 can be opertaed and how?

17. What is the difference between min mode and max mode of 8086?

18. Which bus controller used in maximum mode of 8086?

19. What is stack?

20. Which Stack is used in 8086?

21. What is the position of the Stack Pointer after the PUSH instruction?

22. What is the position of the Stack Pointer after the POP instruction?

23. What is interrupt?

24. What are the various interrupts in 8086?

25. What is meant by Maskable interrupts?

26. What is Non-Maskable interrupts?

27. Which interrupts are generally used for critical events?

28. Give example for Non-Maskable interrupts?

29. Give examples for Maskable interrupts?

30. What are SIM and RIM instructions?

31. What is macro?

32. What is the difference between Macro and Procedure?

33. What is meant by LATCH?

34. What is a compiler?

35. What is the disadvantage of microprocessor?

36. What is the 82C55A device?

37. What kind of input/output interface dose a PPI implement?

38. How many I/O lines are available on the 82C55A?

39. Describes the mode 0, mode 1, and mode 2 operations of the 82C55A

40. What is the mode and I/O configuration for ports A, B, and C of an 82C55A after its control registeris loaded with 82H?


Recommended