MICROPROCESSOR PRACTICAL PAPER – ELSC P304 NAME: ROLL NO.: DEPARTMENT OF ELECTRONIC SCIENCE BERHAMPUR UNIVERSITY, BHANJA BIHAR, ODISHA - 760007 INDEX SL.NO NAME OF THE EXPERIMENT 1. PAGE NO Addition of two 8-bit Numbers: Sum 8- 01-02 bit 2. Addition of two 16-bit Numbers: Sum 03 16 Bit 3. Addition of two 8-bit Numbers: Sum 04 16-Bit 4. Subtraction of two 8-bit Numbers 05-06 5. 1’s Complement of 8-bit Number 07 6. 1’s Complement of 16-bit Number 08 7. 2’s Complement of 8-bit Number 09 8. 2’s Complement of 16-bit Number 10-11 9. Verify for shift of 8-bit Number left by 12 one bit 10. Verify for shift of 16-bit Number left 13 by one Bit 11. Verify for Sum of series of 8-bit 14-15 Numbers REMARKS EXPERIMENT NUMBER: -01 AIM OF THE EXPERIMENT: Write a Program using 8085 & verify for: Addition of two 8-bit numbers: APPARATUS REQUIRED: i.8085 Microprocessor Kit ii.5V Power Supply PROGRAM: Memory Address Machine Codes Mnemonics Operands Comments 2000 21,01,25 LXI H, 2501 Get address of first number in pair 2003 7E MOV A, M Move 1st no. into accumulator 2004 23 INX H The HL Pair addresses 2500H 2005 86 ADD M Address the 2nd number 2006 23 INX H HL pairs 2503H 2007 77 MOV M, A Store result in 2503H 2008 EF RST Terminate INPUT DATA: 2101 -13H 2102-12H RESULT: 2103-25H CONCLUSION: The assembly language program for 8-bit addition of two numbers were executed successfully by using 8085 Microprocessor kit. 1 FLOW CHART: START GET THE 1ST NUMBER GET THE 2ND NUMBER ADD TWO NUMBER STORE THE RESULT END 2 EXPERIMENT NUMBER: - 02 AIM OF THE EXPERIMENT: Write a program using 8085 & verify for: Addition of two 16-bit numbers. APPARATUS REQUIRED: 8085 Microprocessor kit 5V Power Supply PROGRAM: Memory address Machine codes 2000 Mnemonics Operands Comments LHLD 200C Load the HL register with 1st 2A, 0C, 20 numbers. 2003 EB DCHG 2004 2A, 0E, 20 LHLD Exchange the HL & DE register 200E Load the HL register with 2nd number 2007 19 DAD 2008 22, 10 ,20 SHLD 200B 76 HLT ADD HL & DE register 2010 Store the result in 2010 Terminate INPUT DATA: 200C – CA (LSB of 1st Number) 200D – A7(MSB of 1st Number) 200E – 6B (LSB of 2nd Number) 200F – B9 (MSB of 2nd Number) RESULT: 2010 – 35 (LSB of 1st Number + LSB of 2nd Number) 2011 – 61(MSB of 1st Number + MSB of 2nd Number) CONCLUSION: The assembly language program for 16-bit addition of two numbers are executed successfully by using 8085 Microprocessor kit. 3 EXPERIMENT NUMBER: -03 AIM OF THE EXPERIMENT: To write a program using 8085 & verify addition of two 8-bit numbers: 16-bits. APPARATUS REQUIRED: 8085 Microprocessor kit 5V Power Supply PROGRAM: Memory address Machine codes Mnemonics Operands Comments 2001 21, 20, 20 LXI H, 2020 Get address for 1st in pair. 2004 0E, 00 MVI C, 00 Counter is set to be 0 2006 7E MOV A, M Move 1st no. into accumulator 2007 23 INX H The HL pair address 2021H 2008 86 ADD M Add the 1st no. with 2nd no. 2009 D2, 0D, 20 JNC 200DH Carry? No, Go to address 200D 200C 0C INR C Yes, the increment counter 200D 32, 50, 20 STA 2050H LSBs of Sum in 2050H 2010 7E MOV A, C MSB of Sum in an accumulator 2011 32,51,20 STA 2051H MSBs of Sum in 2051H 2014 76 HLT Terminate INPUT DATA: 2020 – 98H 2021 - 9AH RESULT: 2050 – 32H (LSBs of Sum) 2051 – 01H (MSBs of Sum) CONCLUSION: The assembly language program for addition of two 8-bit numbers executed successfully by using 8085 Microprocessor kit. 4 EXPERIMENT NUMBER: -04 AIM OF THE EXPERIMENT: Write a program using 8085 & verify for: Subtraction of two 8-bit numbers. APPARATUS REQUIRED: 8085 Microprocessor Kit 5V Power supply PROGRAM: Memory address Machine codes 2000 21, 01 ,75 Mnemonics Operands Comments LXI H, 2501 Get address of I 87 number in HL Pair 2003 7E MOV A, M Move 1st number in accumulator 2004 23 INX H HL pairs 2502H 2005 96 SUB M Subtract 2nd number from 1st number 2006 23 INX H HL pairs 2543H 2007 77 MOV M, A Movements of accumulator 2008 76 HLT Terminate INPUT DATA: 2501 – 20H 2502 – 10H RESULT: 2503 – 10H CONCLUSION: The assembly language program for subtraction of two 8-bit number was executed successfully by using 8085 Microprocessor Kit. 5 FLOW CHART: START GET THE 1ST NUMBER GET THE 2ND NUMBER ADD TWO NUMBER STORE THE RESULT END 6 EXPERIMENT NUMBER: -05 AIM OF THE EXPERIMENT : Write a program using 8085 and verify for : find one’s complement of an 8bit number . APPARATUAS REQUIRED : 1. 8085 Microprocessor kit 2. 5V power supply PROGRAM : Memory Machine Code Mnemonics Operands Comments 2000 3A,01,25 LDA 2501H Get data in accumulator 2003 2F CMA 2004 32,02,25 STA 2007 76 HLT Take it and complement 2502H Store the result in2502H Halt DATA : 2501-96H RESULT : 2502-69H CONCLUSION : The assembly language programme for one’s complement of a 8 bit number was executed successfully by using 8085 microprocessor Kit. 7 EXPERIMENT NUMBER: - 06 AIM OF THE EXPERIMENT:Write a program using 8085 and verify for: find one’s complements of 16-bit power supply. APPRATUS REQUIRED :1.8085 microprocessor kit 2. 5V power supply PROGRAM: Memory Machine Mnemonics Operands Comments LXI H,2501H Add. Of Ls Bs of the no. 8 LSBs of Code 2000 21,01,25 the no. in accumulator 2003 7E MOV A,M Complement of 8 LSBs of the no. 2004 2F CMA 2005 32,13,25 STA 2503H Store 8 LSBs of result. 2006 23 INX H Address of 8 MSBs of the no. 2009 7E MOV AM 8 MSBs of the no. of accumulator 200A 2F CMA 200B 32,04,25 STA 200E 76 HLT Complement of 8 LSBs of the no. Complement of 8 MSBs of the no. 2504 Store of 8 MSBs of the result. Halt DATA : 2501-85H , LSBs of the number. 2502-54H , MBBs of the number. RESULT : 2503-7AH, LSBs of the result. 2504-ABH , MSBs of the result. CONCLUSION : The assembly language program for one’s complement of a 16-bit , number was executed successfully by using 8085 microprocessor kit. 8 EXPERIMENT NUMBER: -07 AIM OF THE EXPERIMENT: Write a program using 8085 & verify for: find Two’s complement of 8-bit number. APPARATUS REQUIRED: 8085 Microprocessor Kit 5V Power Supply PROGRAM: Memory address Machine Code Operands 2000 2A,01,25 Mnemonics Comments LDA Get data in accumulator take it’s 2501H one’s complement 2003 2F 2004 3C 2005 32,02,25 2008 76 CMA Take two’s complement A INX Store result in 2502H 2502H STA HLT Stop DATA: 2501-46H RESULT: 2502-6AH CONCLUSION: The assembly language program for two’s complement of an 8-bit number was executed successfully by using 8085 Microprocessor. 9 EXPERIMENT NUMBER: -08 AIM OF THE EXPERIMENT: Write a program using 8085 Microprocessor & verify for find two’s complement of a 16-bit number. APPARATUS REQUIRED: • 8085 Microprocessor Kit • 5v Power Supply PROGRAM: Memory Machine address code 2000 21,01,25 Label Mnemonics Operands LXI H,2501H Comments Address of the 8bit of the number 2003 06,00 MVI B,00 Use register B to store carry 2005 7E ADI A,M 8 LSBs in accumulator 2006 2F STA 1’s complement of LSBs of the number 2007 C6,01 INR 01 2’s complement of 8 LSBs of the number 2009 32,03,25 STA 2503H 200C D2,10,20 JNC GO 200F 04 INR B Store carry 2010 23 INX H Address of 8LsBs of the number 2012 7E MOV A,M 1’s complement of LSBs of the GO Store 8LsBs of the result number 2011 2F CMA 8MsBs in accumulator 2013 80 ADD B Add carry 2014 32,04,25 STA 2504H Store 8MsBs of the result 2017 76 HLT Stop DATA: • 2501-8C (LSBs of the number) • 2502-5B (MSBs of the number) 10 RESULT: • 2503-74 (LSBs of the result) • 2504-A4 (MSBs of the result) CONCLUSION: The assembly language program for 2’s compliment of a 16-bit number was executed successfully by using 8085 Microprocessor kit. 11 EXPERIMENT NUMBER - 09 AIM OF THE EXPERIMENT : Write a program using 8085 & verify for: shift 8-bit number let’s by one bit. APPARATUS REQUIRED : 8085 Microprocessor kit 5V power supply PROGRAM : Memory Machine code Mnemonics Operands Comments 2000 8A,01,25 LDA 2501H Get data in accumulator 2003 87 ADD A Shift 11 left by one bit 2004 32,02,25 STA 2502H Store result in accumulator 2007 76 HLT address Halt DATA : 2501-65H RESULT : 2502-CAH CONCLUSION : The assembly language program for shift on bit number left by one bit was executed successfully by using 8085 microprocessor kit. 12 EXPERIMENT NUMBER:-10 AIM OF THE EXPERIMENT:Write a program using 8085 & Verify for : shift a 16 bit number by 1-bit. APPARATUS REQUIRED:8085 Microprocessor kit 5V power supply PROGRAM:MEMORY MACHINE MNEMONICS OPERANDS COMMENTS ADDRESS CODE 2000 2A,01,25 LHLD 2501H Get data in HL pair. 2003 29 DAD H Shift left by one bit. 2004 22,03,25 SHLD 2503H Store result in 2503 & 2501H 2001 76 HLT Stop DATA:2501-96H,LsBs of the number 2502-75H,MsBs of the number RESULT:2503-2C,LsBs of the result 2594-EB,MsBs of the result CONCLUSION:The assembly language program for shift a 16 bit number by one bit was executed successfully by using 8085 Microprocessor Kit. 13 EXPERIMENT NUMBER: -11 AIM OF THE EXPERIMENT: Write a program using 8085 Microprocessor & verify for: Sum of the series of 8-bit numbers. APPARATUS REQUIRED: • 8085 Microprocessor Kit • 5v Power Supply PROGRAM: Memory Machine address code 2400 Label Mnemonics Operands Comments 21, 00, 25 LXI H, 2500H Address for the count in HL pair 2403 4E MOV C, M The count in register c 2404 3E, 00 MVI A, 00 Initial value of Sum = 00 2406 23 INX H Address of next data in HL pair 2407 86 LOOP ADD M Previous sum + next sum 2408 0D DCB C Decrement counts 2409 C2, 06, 24 JNZ LOOP If count=0? No jump needed 240C 32, 50, 24 STA 2405H Store sum in 2405H 240F 76 HLT Terminate INPUT DATA: 2500 – 04 2501 – 16 2502 – 2B 2503 – 39 2504 – 12 RESULT: 2504 – 8C CONCLUSION: The assembly language program for Sum of a series of 8-bit number was executed successfully by using 8085 Microprocessor Kit. 14 FLOW CHART: START INITIAL HL PAIR COUNT IN REGISTER C INITIAL VALUE OF SUM = n INCREMENT HL PAIR TO GET NEXT NUMBER SUM = PREVIOUS SUM + NEXT NUMBER DECREMENT COUNT NO IS COUNT IS 0=? YES STORE SUM END 15