Microprocessor and microcontroller lab manual for CSE

cs6412 microprocessor and microcontroller lab manual and microprocessor and microcontroller lab manual for ece 5th sem
KomalMittal Profile Pic
KomalMittal,India,Teacher
Published Date:13-07-2017
Your Website URL(Optional)
Comment
Valliammai Engineering College SRM Nagar, Kattankulathur - 603203 Department of Electrical and Electronics Engineering EE6612–Microprocessors and Microcontrollers Laboratory Manual LAB MANUAL VI Semester - Electrical and Electronics Engineering Academic Year - 2016-2017 ( 2 013 Regulation) Prepared by, Dr.G.Udhayakumar, Associate Professor Mr.V.Sudhagar,AssistantProfessor Mr.S.Balaji, AssistantProfessor Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory 8085 MICROPROCESSOR Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory Ex. No: 1 SIMPLE ARITHMETIC OPERATIONS AIM: To write an assembly language program to add, subtract, multiply and divide the given data stored at two consecutive locations using 8085 microprocessor. a. 8 BIT DATAADDITION: ALGORITHM: 1. Initialize memory pointer to data location. 2. Get the first number from memory in accumulator. 3. Get the second number and add it to the accumulator. 4. Store the answer at another memory location. Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory FLOW CHART: START C 00H HL 4500H A M HL HL+1 A A+M Is there a NO Carry ? YES C C+1 HL HL+1 M A HL HL+1 M C STOP Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory PROGRAM: ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT 4100 START MVI C, 00 Clear C reg. 4101 4102 LXI H, 4500 Initialize HL reg. to 4103 4500 4104 4105 MOV A, M Transfer first data to accumulator 4106 INX H Increment HL reg. to point next memory Location. 4107 ADD M Add first number to acc. Content. 4108 JNC L1 Jump to location if 4109 result does not yield carry. 410A 410B INR C Increment C reg. 410C L1 INX H Increment HL reg. to point next memory Location. 410D MOV M, A Transfer the result from acc. to memory. 410E INX H Increment HL reg. to point next memory Location. 410F MOV M, C Move carry to memory 4110 HLT Stop the program Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory b. 8 BIT DATA SUBTRACTION ALGORITHM: 1. Initialize memory pointer to data location. 2. Get the first number from memory in accumulator. 3. Get the second number and subtract from the accumulator. 4. If the result yields a borrow, the content of the acc. is complemented and 01H is added to it (2’ s complement). A register is cleared and the content of that reg. is incremented in case there is a borrow. If there is no borrow the content of the acc. is directly taken as the result. 5. Store the answer at next memory location. Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory START FLOW CHART: C 00H HL 4500H A M HL HL+1 A A-M NO Is there a Borrow? YES Complement A Add 01H to A C C+1 HL HL+1 M A HL HL+1 M C STOP Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory PROGRAM: ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT 4100 START MVI C, 00 Clear C reg. 4101 4102 LXI H, 4500 Initialize HL reg. to 4103 4500 4104 4105 MOV A, M Transfer first data to accumulator 4106 INX H Increment HL reg. to point next mem. Location. 4107 SUB M Subtract first number from acc. Content. 4108 JNC L1 Jump to location if 4109 result does not yield borrow. 410A 410B INR C Increment C reg. 410C CMA Complement the Acc. content 410D ADI 01H Add 01H to content of 410E acc. 410F L1 INX H Increment HL reg. to point next mem. Location. 4110 MOV M, A Transfer the result from acc. to memory. 4111 INX H Increment HL reg. to point next mem. Location. 4112 MOV M, C Move carry to mem. 4113 HLT Stop the program Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory c. 8 BIT DATA MULTIPLICATION: ALGORITHM: LOGIC: Multiplication can be done by repeated addition. 1. Initialize memory pointer to data location. 2. Move multiplicand to a register. 3. Move the multiplier to another register. 4. Clear the accumulator. 5. Add multiplicand to accumulator 6. Decrement multiplier 7. Repeat step 5 till multiplier comes to zero. 8. The result, which is in the accumulator, is stored in a memory location. Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory FLOW CHART: START HL  4500 B  M HL  HL+1 A  00 C  00 A  A +M NO Is there any carry YES C  C+1 B  B-1 NO IS B=0 YES A Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory A HL HL+1 M A HL HL+1 M C STOP Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory PROGRAM: ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENT 4100 START LXI H, 4500 Initialize HL reg. to 4500 4101 4102 Transfer first data to 4103 MOV B, M reg. B 4104 INX H Increment HL reg. to point next mem. Location. 4105 MVI A, 00H Clear the acc. 4106 4107 MVI C, 00H Clear C reg for carry 4108 4109 L1 ADD M Add multiplicand multiplier times. 410A JNC NEXT Jump to NEXT if there is no carry 410B 410C 410D INR C Increment C reg 410E NEXT DCR B Decrement B reg 410F JNZ L1 Jump to L1 if B is not zero. 4110 4111 4112 INX H Increment HL reg. to point next mem. Location. 4113 MOV M, A Transfer the result from acc. to memory. 4114 INX H Increment HL reg. to point next mem. Location. 4115 MOV M, C Transfer the result from C reg. to memory. 4116 HLT Stop the program Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory d. 8 BIT DIVISION: ALGORITHM: LOGIC: Division is done using the method Repeated subtraction. 1. Load Divisor and Dividend 2. Subtract divisor from dividend 3. Count the number of times of subtraction which equals the quotient 4. Stop subtraction when the dividend is less than the divisor .The dividend now becomes the remainder. Otherwise go to step 2. 5. Stop the program execution. Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory START FLOWCHART: B  00 HL  4500 A  M HL  HL+1 M  A-M B  B +1 No IS A0 Yes A A+ M YES B  B-1 HL HL+1 M A HL HL+1 M B STOP Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory PROGRAM: ADDRESS OPCODE LABEL MNEMONICS OPERAND COMMENTS 4100 MVI B,00 Clear B reg for quotient 4101 4102 LXI H,4500 Initialize HL reg. to 4500H 4103 4104 4105 MOV A,M Transfer dividend to acc. 4106 INX H Increment HL reg. to point next mem. Location. 4107 LOOP SUB M Subtract divisor from dividend 4108 INR B Increment B reg 4109 JNC LOOP Jump to LOOP if 410A result does not yield borrow 410B 410C ADD M Add divisor to acc. 410D DCR B Decrement B reg 410E INX H Increment HL reg. to point next mem. Location. 410F MOV M,A Transfer the remainder from acc. to memory. 4110 INX H Increment HL reg. to point next mem. Location. 4111 MOV M,B Transfer the quotient from B reg. to memory. 4112 HLT Stop the program Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory OBSERVATION: ADDITION: S.NO INPUT OUTPUT ADDRESS DATA ADDRESS DATA 1 4500 4502 4501 4503 2 4500 4502 4501 4503 SUBTRACTION: S.NO INPUT OUTPUT ADDRESS DATA ADDRESS DATA 1 4500 4502 4501 4503 2 4500 4502 4501 4503 MULTIPLICATION: S.NO INPUT OUTPUT ADDRESS DATA ADDRESS DATA 1 4500 4502 4501 4503 2 4500 4502 4501 4503 DIVISION: S.NO INPUT OUTPUT ADDRESS DATA ADDRESS DATA 1 4500 4502 4501 4503 2 4500 4502 4501 4503 Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory RESULT: Thus the addition, subtraction, multiplication and division of two numbers was performed using the 8085 microprocessor. Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory Ex. No: 2 Ascending / Descending order, Maximum / Minimum of numbers AIM: To write an assembly language program to arrange an array of data in ascending and descending order and to find the smallest and largest data among the array. a. ASCENDING ORDER ALGORITHM: 1. Get the numbers to be sorted from the memory locations. 2. Compare the first two numbers and if the first number is larger than second then I interchange the number. 3. If the first number is smaller, go to step 4 4. Repeat steps 2 and 3 until the numbers are in required order Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory FLOWCHART: START HLß 4200H Cß HL Cß C -1 Dß C HLß4201H Aß HL HLß HL + 1 Yes Is A HL? No Bß HL HLß A HLß HL - 1 HLß B HLß HL + 1 Dß D – 01 H A Department of Electrical and Electronics Engineering - VECEE6612 – Microprocessors and Microcontrollers Laboratory A No IS D = 0? Yes Cß C-1 No IS C = 0? Yes STOP Department of Electrical and Electronics Engineering - VEC