Microprocessor & Interfacing LAB 501) (Becp: Lab Ma Nual V Semester
Microprocessor & Interfacing LAB 501) (Becp: Lab Ma Nual V Semester
Microprocessor & Interfacing LAB 501) (Becp: Lab Ma Nual V Semester
Interfacing LAB
(BECP 501)
LAB MA NUAL
V SEMESTER
3
To perform BCD To HEX Conversion and HEX to BCD
Conversion.
4
To Design Counter Using Timer
6
Interfacing with 8085/8086-8279, 8251.
8
Stepper motor Interfacing and Seven Segment Display
Interfacing using 8051.
Experiment -1( a)
Objective: To Perform Addition and Multiplication of two 8 bit numbers.
ALGORITHM:
1. Initialize memory pointer to data location.
2. Get the first number from memory in accumulator.
3. Get the second number and perform Addition from the accumulator.
4. If the result yields a carry, the content of the acc. is maintained and 01H is
added to Reg C. Reg. C is a register is cleared and the content of that reg. is
incremented in case there is a Carry. If there is no carry the content of the acc.
is directly taken as the result.
5. Store the answer at next memory location.
Flow Chart:
RESULT:
Thus the 8 bit numbers stored at 4500 &4501 are added and the result stored at 4502 & 4503.
OBSERVATION:
Experiment-1(b)
ALGORITHM:
6. Decrement multiplier.
OBSERVATION:
RESULT:
Thus the 8-bit multiplication was done in 8085p using repeated addition
method.
Experiment-2
ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
6. Compare the accumulator content with the memory content (next element).
7. If the accumulator content is smaller, then move the memory content (largest element) to
the accumulator. Else continue.
OBSERVATION:
RESULT:
Thus the largest number in the given array is found out.
Experiment-3(a)
ALGORITHM:
1. Initialize memory pointer to 2050
2. Get the most significant digit
3. Multiply the MSD by 10 using repeated addition
4. Add LSD to result obtained in above step
5. Store the converted result in memory 2052
Flow Chart:
PROGRAM:
OBSERVATION:
INPUT OUTPUT
2000 200C
2001
Experiment-3(b)
ALGORITHM:
1).Initialize memory pointer to 5000 H
2. Get the Hexa decimal number in C – register
3. Perform repeated addition for C number of times
4. Adjust for BCD in each step
5. Store the BCD data in Memory
Flow Chart:
ADDRESS OPCODE LABLE MNEMONICS OPRAND COMMENT
F000 LXI H Initialize memory pointer
F001 00
F002 80
F003 MVI D Clear D- reg for Most significant Byte
F004 00 .
F005 XRA A Clear Accumulator
F008 01
F009 DAA Adjust for BCD count
F00A SKIP JNC Jump to SKIP.
F00D INR D Increase D
F00E SKIP DCR C Decrease C register
F00F Loop JNZ Jump to LOOP
F012 MOV L, A Load the Least Significant Byte
F013 MOV H, D Load the Most Significant Byte
F014 SHLD 8050H Store the BCD
F017 HLT Terminate the program
F016
PROGRAM:
OBSERVATION
INPUT OUTPUT
5020
FLOW CHART:
4. Stop subtraction when the dividend is less than the divisor .The dividend now becomes the
remainder. Otherwise go to step 2.
PROGRAM:
OBSERVATION:
RESULT:
Thus an ALP was written for 8-bit division using repeated subtraction method
and executed using 8085p kits.
Experiment-5
Algorithm –
1. Initialize the MSBs of difference to 0
Flow chart
Program
2001 00
2002 80
2003 MVI D Clear D- reg for Most significant Byte
2004 00 .
2005 XRA A Clear Accumulator
FLOW CHART:
9. Stop subtraction when the dividend is less than the divisor .The dividend now becomes the
remainder. Otherwise go to step 2.
PROGRAM:
OBSERVATION:
RESULT:
Thus an ALP was written for 8-bit division using repeated subtraction method
and executed using 8085p kits.
FLOW CHART:
RESULT:
Thus an ALP program for 16-bit addition was written and executed in 8085p
using special instructions.
Experiment-4(b)
3. Get the minuend from memory and store it in another register pair.
PROGRAM:
RESULT:
Thus an ALP program for subtracting two 16-bit numbers was written and
executed.
Experiment-5(a)
Aim: To multiply two 16 bit numbers and store the result in memory.
ALGORITHM:
1. Get the multiplier and multiplicand.
FLOW CHART:
PROGRAM:
RESULT:
Thus the 16-bit multiplication was done in 8085p using repeated addition
method.
Experiment-5(b)
Aim: To divide two 16-bit numbers and store the result in memory using 8085
mnemonics.
ALGORITHM:
1. Get the dividend and divisor.
2. Initialize the register for quotient.
3. Repeatedly subtract divisor from dividend till dividend becomes less than divisor.
4. Count the number of subtraction which equals the quotient.
5. Store the result in memory.
PROGRAM:
FLOW CHART:
OBSERVATION:
RESULT:
Thus the 16-bit Division was done in 8085p using repeated subtraction
method.
Experiment-6(a)
ALGORITHM:
10. Place all the elements of an array in the consecutive memory locations.
11. Fetch the first element from the memory location and load it in the accumulator.
12. Initialize a counter (register) with the total number of elements in an array.
13. Decrement the counter by 1.
14. Increment the memory pointer to point to the next element.
15. Compare the accumulator content with the memory content (next element).
16. If the accumulator content is smaller, then move the memory content (largest element)
to the accumulator. Else continue.
17. Decrement the counter by 1.
18. Repeat steps 5 to 8 until the counter reaches zero
10.Store the result (accumulator content) in the specified memory location.
OBSERVATIONS:
RESULT:
Thus the largest number in the given array is found out.
Aim:
Experiment-6(b)
ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
6. Compare the accumulator content with the memory content (next element).
7. If the accumulator content is smaller, then move the memory content (largest element) to
the accumulator. Else continue.
PROGRAM:
OBSERVATION:
RESULT:
Experiment-7(a)
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
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.
PROGRAM:
Aim:
OBSERVATION:
RESULT:
Thus the ascending order program is executed and thus the numbers are arranged in ascending
order.
Experiment-7(b)
ALGORITHM:
PROGRAM:
Aim:
OBSERVATION:
RESULT:
Thus the descending order program is executed and thus the numbers are arranged in
descending order.
Experiment-8(a)
ALGORITHM:
6. Initialize the memory location to the data pointer.
7. Increment B register.
8. Increment accumulator by 1 and adjust it to decimal every time.
9. Compare the given decimal number with accumulator value.
10. When both matches, the equivalent hexadecimal value is in B register.
11. Store the resultant in memory location.
FLOW CHART:
Aim:
PROGRAM:
OBSERVATION:
RESULT:
Thus an ALP program for conversion of decimal to hexadecimal was written
and executed.
Experiment-8(b)
ALGORITHM:
1. Initialize the memory location to the data pointer.
2. Increment B register.
3. Increment accumulator by 1 and adjust it to decimal every time.
4. Compare the given hexadecimal number with B register value.
5. When both match, the equivalent decimal value is in A register.
6. Store the resultant in memory location.
FLOW CHART:
PROGRAM:
Aim:
OBSERVATION:
RESULT:
Thus an ALP program for conversion of hexadecimal to decimal has been written and
executed.
Experiment-9(a)
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. Adjust the accumulator value to the proper BCD value using DAA instruction.
5. Store the answer at another memory location.
PROGRAM:
Aim:
OBSERVATION:
RESULT:
Thus the 8 bit BCD numbers stored at 4500 &4501 are added and the result
stored at 4502 & 4503.
Experiment-9(b)
ALGORITHM:
PROGRAM:
Aim:
OBSERVATION:
RESULT:
Thus the 8 bit BCD numbers stored at 4500 &4501 are subtracted and the result
stored at 4502 & 4503.
Experiment-10
ALGORITHM:
1. Load the 2 input matrices in the separate address and initialize the HL and the DE
register pair with the starting address respectively.
2. Call a subroutine for performing the multiplication of one element of a matrix with
the other element of the other matrix.
3. Call a subroutine to store the resultant values in a separate matrix.
PROGRAM:
Aim:
FLOW CHART:
OBSERVATION:
RESULT:
Thus the 2 x 2 matrix multiplication is performed and the result is stored at 4700,
4701 , 4702 & 4703.