Microprocessor practical file, Lab Reports of Microprocessors

Good practice for learning the microprocessor

Typology: Lab Reports

2020/2021

Uploaded on 10/14/2021

tushar-khurana-66
tushar-khurana-66 🇮🇳

1 document

1 / 44

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Name – Tushar khurana Roll No. - 190010800066
GOVT. POLYTECHNIC,AMBALA
CITY
Practical lab manual
Microprocessors And Peripheral Devices
Summited by :- Summited to:-
Tushar khurana. Payal mam
190010800066 ______________
Semester-4
Computer engineering.
Remarks
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f
pf20
pf21
pf22
pf23
pf24
pf25
pf26
pf27
pf28
pf29
pf2a
pf2b
pf2c

Partial preview of the text

Download Microprocessor practical file and more Lab Reports Microprocessors in PDF only on Docsity!

GOVT. POLYTECHNIC,AMBALA

CITY

Practical lab manual

Microprocessors And Peripheral Devices

Summited by :- Summited to:-

Tushar khurana. Payal mam

190010800066 ______________

Semester-

Computer engineering.

Experiment-

Aim: Familarization of different keys of 8085 microprocessor kit and its memory map. Apparatus Required : Microprocessor Kit along with its supply and user manual. Theory : Microprocessor 8085 trainer kit is a single board computer using 8085 microprocessor kits of different manufacturer’s may have different features and specifications. For features and specifications of a particular kit, one has to refer its user manual. The main features of a typical microprocessor kit are: CPU: The kit has a high performance 8085 CPU operating at 3.072MHz clock frequency. DISPLAY : The kit has six seven- segment display digits. Four digits(left most) are used for displaying the address of a location or name of a register. Rest of the two digits are used for displaying the contents of the memory location/register. All the six digits of the display shows the data in hexadecimal form normally. MEMORY : 8085 microprocessor has 16-bit address bus and 8-bit data bus. Thus a maximum of 64k bytes of memory (RAM/ROM) can be provided with a 8085 kit. The kit has three memory sockets with memory map as under:

8279(KB/Display 18-1F H 18 and IC – Data port Controller) 19 and ID – Command Port 8259(PIC) 20-2F H 20 – Status Register 21 – Comment Register Keyboard : The kit has 28 keys keyboard. These are 16 hexadecimal keys (0-F), ten functions keys, RESET key and SHIFT key. The function of these keys is as under: KEY Function RESET - Reset the systems VCT INT - Hardware interrupt via keyboard, RST 7.5. SHIFT - Provides a second level command to keys. GO - To execute the program.

SI - To execute the program in single step mode. EXREG - Examine memory,allows user to examine and modify the contents of different registers. EXMEM - Examine Memory; allows user to examine any memory location and modify any RAM location. PRE - Previous is used as an intermediate terminator in case of Examine memory. It decrements the pc content and write the contents of data fields to the address displayed in the address location. NEXT - Increment is used as a intermediate terminator in case of examine memory. Examine register etc. it increments the pc contents and writes the data lying in data field at the location displayed at address field. “.” - Terminator is used to terminate the command and write the data in the data field at the location displayed in address field. DEL. - Delete the part of program or data, with relocation by one or more bytes. INS - Inserts the part of the program or data, with relocation by one or more bytes. B.M - Allows user to move a block of memory to any RAM area. FILL - Allows user to fill RAM area with a constants. REL - Relocates a program written for some memory area and to be transferred to other memory area. INS DATA - Inserts one or more data bytes in the users program/data area. DEL DATA - Deletes one or more data bytes from the users program/data area. STRING - Finds out the string of data bytes from the users program/data area.

Experiment-

Aim : Steps to enter, modify data/program and to execute a program on 8085 kit. Apparatus Required : 8085 kit and power supply. Theory : In all assembly language programming(ALP) exercises, following procedural steps are followed: Step 1 : Analyzing the Problem : The first steps in writing a program is to analyse the problem for which we want to write the program. Step 2 : Representing program operations : The sequence of operations used to solve a programming problem is called algorithm. Write algorithm and /or draw flow chart for the problem. Step 3 : Writing ALP : Find out the instructions required for each part of the program and finally write the ALP program. Step 4 : Machine Codes : With the help of instruction table, assembly language program is manually converted into machine codes. Step 5 : Loading/Entering the program : The hex codes of the program are to be entered into RAM of the kit. Step to enter program in the kit are :  Press RESET key  Press EXMEM key  Enter program Starting Address. Entered address will be displayed in the address field of the display.  Press NEXT key. The data field will shows the memory contents.  Enters the Hex code of the displayed memory location. Entered hex code will be displayed in the data display field.  Press NEXT key. Address field will show the next memory address.  Repeat above two steps until last hex code is filled.  Press. (Dot) key In a similar way, the input data of the program (if any) can be stored at the appropriate memory location with the help of EXMEM,NEXT,PRE(previous) and * (dot) keys.

Step 6 : Execute the program : After entering the program in 8085 kit memory, it can be executed by following steps : 1.) Press RESET key 2.) Press GO key 3.) Enter Program starting Address 4.) Press. (Dot) key The CPU will start executing the program and E will be displayed in the address field. The program will start execution can be done in single steps also and for this following steps are to be followed : 1.) Press RESET key 2.) Press S1 key 3.) Enter Program starting Address 4.) Press NEXT key. The contents of entered address is displayed 5.) Press NEXT key. One instruction is executed and address of next instruction is displayed. 6.) Repeat above steps to execute any numbers of instructions one by one. 7.) Press. (Dot) key to end single stop execution. Step 7 : Checking the Result : After the execution of the program, the next step is to see the result. The result may be in a memory location or in a CPU register. To view memory contents,following steps are executed : 1.) Press EXMEM key 2.) Enter address of the memory location where result lies. 3.) Press NEXT key. Contents of the memory location are shown on the data field of the display. 4.) Press NEXT/PRE key to see contents of Next/Previous Memory location. 5.) Press. (Dot) key to end examine memory command To view contents of the CPU registers, following steps are executed : 1.) Press shift and EXREG keys 2.) Press “A” key to check accumulator contents

Program Output : After execution of the program, the registers A and C contents are 08 H.

Experiment-

Aim : Writing and execution of ALP for addition and subtraction of two 8 bit numbers. Apparatus Required : 8085 kit and power supply. Theory : Problem is analyzed and assembly language program for the problems is written using the instructions MOV,LXI,INX,ADD,SUB,STA and HLT. PROGRAM for Addition of two 8-bit Numbers(Result 8 bit) : The first number 48 H is in memory location 2401. The second number 56 H is in memory location 2402. The result is to be stored in memory location 2403. Memory Machine Mnemonics Operands Comments Address Code 2000 21.01.24 LXI H, 2401H Place address of t the 1 st number in H-L Register pair 2003 7 E MOV A.M Move the contents of memory Addressed by H-L pair To the accumulator 2004 23 INX H increased the con- o tents of H-L pair by

Memory Machine Mnemonics Operands Comments Address Code 2000 21,01,24 LXI H, 2401 Load address of First number in the Register pair H-L. 2003 7E MOV A,M Move the first Number in Accumulator. 2004 23 INX H Add 1 to the Contents of H-L Register pair. 2005 96 SUB M Subtract 2 nd number From the first no. and The result is placed in The accumulator. 2006 23 INX H Get memory address 2403 in the H-L pair. 2007 77 MOV M.A Move the contents of Accumulator to the Memory location whose Address is in the H-L Register pair. 2008 76 HLT STOP

Result : 48H – 33H = 15H The first instruction LXI H, 2401 H will load the address (2401) of the first number in the register pair H-L. its machine code is 21,01,24. The instruction MOV A, M will move the first number in the accumulator. Its machine code is 7E. the instruction INX H will increase the contents of H-L register pair by 1 i.e. H-L register pair now contains 2402. The instruction SSUB M will subtract the contents of that memory location whose address is in the register pair H-L register pair now contains 2402. The instruction SUB M will subtract the contents of that memory location whose address is in the register pair H-L from the contents of accumulator. So the 2 nd number is subtracted from the first number and the result is placed in the accumulator. The instruction INX H will increase the contents of H-L pair by 1. after this instruction the H-L register pair will contain the address

  1. The next instruction MOV M, A will move the contents of the accumulator to the memory location whose address is in the H-L register pair Procedure : a.) Connect the power supply to the 8085 kit and switch on the power supply. b.) Enter the program and the input data. c.) Execute the program. d.) Check the result.

Added by 0 2009 B 8 CMP B Compare the two number 200 A D2,11,20 JNC A HEAD I If no carry(A>=B), Than jump to A head I 200 D 58 MOV E,B if carry(B>A), store B in E 200E C3,13,20 JMP A HEAD 2 unconditionally jump To A head 2 2011 5F AHEAD1 MOV E,A Bigger No.(A) copied In E 2012 78 MOV A,B Smaller No.(B) copied In A 2013 21,00,00 AHEAD2 LXI H,0000 H Place initial product 0000 H in HL 2016 B7 ORA A to check A= 2017 CA,1F,20 JZ FINISH If A=0 : Multiplication over 201 A 19 LOOP DAD D Hl=HL+DE Product=product+ No. 201 B 3D DCR A Decrement count by 1

201 C C2,1A,20 JNZ LOOP if A≠0 then repeat 201 F 22, 03,24 FINISH SHLD 2403H store result 2022 76 HLT Stop The instruction LDA 2401H, loads first number in register A. MOV B, A instruction copies that number in register B and instruction LDA 2402 H stores 2nd^ number in A. instruction MVI D, 00H is used to clear the contents of D register as DE is to be used to store the number which is used to store the number which is added to product repeatedly. It zero then multiplication. Instruction DAD D adds DE register pair contents to HL register pair. Register A is decremented by 1. Instruction JNZ loop will transfer to the control back to DAD D instruction till number 82H is not added to HL register 14H times. Instruction SHLD 2403H result at memory location 2403 H and 2404 H with LSB at 2403 H and MSB at 2404 H. after the execution of the program, the contents of memory location 2403 H and 2404 H will be 28H and 0A AH respectively as 82 H (130 D) x 14 H (20D) = 0A 28H ( D). ALP for Division : Suppose dividend (82 H) is stored at 2500 H, and divisor (14 H) at memory location 2501 H. Program store remainder at location 2502 H and quotient at location 2503 H. Memory Machine Label Mnemonics Operand Comments Address Code 2000 3A,01,25 LDA 2501 H store divisor In A 2003 B7 ORA A check whether Divisor = 0 2004 C2,0C,20 JNZ AHEAD if not, jump Ahead 2007 0E,FF MVI C,FF H if yes, Quotient = FFH

Register C is initialized to 00H as initial quotient. Instruction CMP B, compares A (dividend) with B(divisor). Carry sets if A<B and in that case next instruction JC OVER transfers program control to the instruction with label OVER. Otherwise, divisor (B) is subtracted from dividend (A) and C (quotient) is incremented by 1. Program control is transferred back to instruction with label loop by the instruction JMP loop. Now remainder is left in A and quotient is in C. Both are stored at memory locations 2502 H and 2503 H respectively. After execution of the program, the contents of the memory locations 2502 H and 2503 H will be 0AH and 06 H respectively as 2 H(130 D) ÷ 14 H (20 D) = 06 H (06 D) as quotient and 0AH (10 D) as remainder. Procedure : A.) Connect the power supply to the 8085 kit and switch on the power supply. B.) Enter the program and the input data. C.) Execute the program. D.) Check the result.

Experiment-

Aim : Writing and execution of ALP for arranging numbers in ascending/ descending order. Apparatus Required : 8085 kit and power supply. Theory : There are different methods to sort a series of numbers. One simple method to arrange the number in ascending order is as under: Select the first number of the series of N numbers in accumulator. Then compare this number with rest of (N-1) numbers one by one. If the selected number is greater than the number of the series,then interchange the two number. When all the (N-1) comparisons are over, save the selected number (in accumulator) at the first memory location. Now repeat the whole process for next(N-1) number and so on till one number is left. Method to arrange number is descending order is similar to arranging the numbers in ascending order. In ascending order case, the contents of accumulator and memory location are interchanged when accumulator contents are greater than contents of memory location. But in descending order case, accumulator and memory location contents are interchanged when accumulator contents are less than contents of memory location. ALP for Arranging Numbers in Ascending order : Suppose length of the series (N) is stored at location 2050H and the numbers are stored at memory locations starting from 2051 H. Program : Memory Machine Label Mnemonics Operands Comments Address Code 2000 31,00,25 LXI SP, 2500 H initialize stack