Microprocessor_Lab_Manual Final for Print
Microprocessor_Lab_Manual Final for Print
– 1(a)
OBJECTIVE:
Write a program to add two hexadecimal & decimal numbers.
APPARATUS REQUIRED: -
DESCRIPTION/ALGORITHM:-
Hexadecimal Addition: The program takes the content of 2009, adds it to 200B & stores the result
back at 200C.
Steps: 1. Initialize HL Reg. pair with address where the first number is lying.
2. Store the number in accumulator.
3. Get the second number.
4. Add the two numbers and store the result in 200B.
5. Go back to Monitor
Let: (2009 H) = 80 H
(200B H) = 15 H
Result = 80 H + 15 H = 95 H
(2009 H) A
A B
(200B H) A
A + B A
A (200C H)
FLOWCHART : -
Start
1 End
PROGRAM:-
Decimal Addition:
Steps: 1. Initialize HL Reg. pair with address where the first number is lying.
2. Store the number in accumulator.
3. Get the second number.
4. Add the two numbers and store the result in 200B.
5. Go back to Monitor
FLOWCHART:-
Start
st
Get the 1 no.
nd
Get the 2 no.
End
2
PROGRAM:-
REULTS:-
Thus the numbers at 2009H and at memory are added.
3
EXPERIMENT NO. – 1 (b)
OBJECTIVE:- Write a program to subtract two hexadecimal & decimal numbers
APPARATUS REQUIRED: -
DESCRIPTION/ALGORITHM:-
Hexadecimal Subtraction : The program takes the content of 2009, subtracts it to 200B & stores the
result back at 200C.
Steps:-
1. Initialize HL Reg. pair with address where the first number is lying.
2. Store the number in accumulator.
3. Get the second number.
4. Subtract second no from acc and store the result in 200B.
5. Go back to Monitor
FLOWCHART:-
Start
st
Get the 1 no.
nd
Get the 2 no.
End
PROGRAM:-
4
Decimal Subtraction :
Steps:-
1. Initialize HL Reg. pair with address where the first number is lying.
2. Store the number in accumulator.
3. Get the second number.
4. Subtract second no from acc and store the result in 200B.
5. Adjust the decimal
6. Go back to Monitor
FLOWCHART:-
Start
st
Get the 1 no.
nd
Get the 2 no.
End
PROGRAM:-
REULTS:-
Numbers at 2009H and in HL pairs (Memory) are subtracted
5
EXPERIMENT NO. –0 2
OBJECTIVE:- Write a program using 8085 Microprocessor for addition and subtraction of two BCD
numbers.
APPARATUS REQUIRED: -
DESCRIPTION/ALGORITHM:-
Steps: 1. Initialize HL Reg. pair with address where the first number is lying.
2. Store the number in accumulator.
3. Get the second number.
4. Add the two numbers and store the result in 200B.
5. Go back to Monitor
FLOWCHART:-
Start
st
Get the 1 no.
nd
Get the 2 no.
End
6
Steps:-
7. Initialize HL Reg. pair with address where the first number is lying.
8. Store the number in accumulator.
9. Get the second number.
10. Subtract second no from acc and store the result in 200B.
11. Adjust the decimal
12. Go back to Monitor
FLOWCHART:-
Start
st
Get the 1 no.
nd
Get the 2 no.
End
PROGRAM:-
REULTS:-
The BCD numbers at 2009H and memory are added or substracted.
7
EXPRIMENT NO. – 3 (a)
OBJECTIVE: - Write a program to perform multiplication of two 8 bit numbers using bit addition
method
APPARATUS REQUIRED: -
Sr. no. Name of equipments/ components/ software Specification/range/rating/ Quantity
version
1 8085 Microprocessor programming kit, SCIENTECH-8085 1
instruction coding sheet.
2. Power supply A.C (230V Mains)
DESCRIPTION/ALGORITHM:-
1) Start the program by loading HL register pair with address of memory location.
2) Move the data to a register (B register).
3) Get the second data and load into Accumulator.
4) Add the two register contents.
5) Check for carry.
6) Increment the value of carry.
7) Check whether repeated addition is over and store the value of product and carry in memory location.
FLOWCHART:
START
Is Carry?
Yes
Increment D register No
No
Is zero?
If Yes
15 END
PROGRAM:
REULTS:-
Input: FF (4150)
FF (4151)
Output: 01 (4152)
FE (4153)
16
EXPRIMENT NO. – 3 (b)
OBJECTIVE: - Write a program to perform multiplication of two 8 bit numbers using bit rotation method
APPARATUS REQUIRED: -
DESCRIPTION/ALGORITHM:-
1) Start the program by loading HL register pair with address of memory location.
2) Move the data to a register (E register).
3) Get the second data and load into Accumulator.
4) Add the two register contents.
5) Check for carry.
6) Increment the value of carry.
7) Check whether repeated addition is over and store the value of product and carry in memory location.
8) Terminate the program.
EXAMPLE :
B7 B6 B5 B4 B3 B2 B1 B0 CY B3 B2 B1 B0
0 0 0 0 0 0 0 0 0 0 1 0 1 Initial Stage
Step 1 0 0 0 0 0 0 0 0 0 1 0 1 0 Shift left by 1
0 0 0 0 0 0 0 0 0 1 0 1 0 Don’t add since CY= 0
Step 2 0 0 0 0 0 0 0 0 1 0 1 0 0 Shift
0 0 0 0 1 1 0 0 1 0 1 0 0 Add multiplicand;CY=1
Step 3 0 0 0 1 1 0 0 0 0 1 0 0 0 Shift left by 1
0 0 0 1 1 0 0 0 0 1 0 0 0 Don’t add since CY= 0
Step 4 0 0 1 1 0 0 0 0 1 0 0 0 0 Add multiplicand;CY=1
PROGRAM:
REULTS:-
Multiplication has been carried out between the data of 2200H and 2201 H.
18
EXPRIMENT NO. – 4 (a)
OBJECTIVE: - Write a program to perform division of two 8 bit numbers using Repeated Subtraction
method.
APPARATUS REQUIRED: -
Sr. no. Name of equipments/components/software Specification/range/rating/version Quantity
1 8085 Microprocessor programming kit, SCIENTECH-8085 1
instruction coding sheet.
2. Power supply A.C (230V Mains)
DESCRIPTION/ALGORITHM:-
1) Start the program by loading HL register pair with address of memory location.
2) Move the data to a register (B register).
3) Get the second data and load into Accumulator.
4) Compare the two numbers to check for carry.
5) Subtract the two numbers.
6) Increment the value of carry.
7) Check whether repeated subtraction is over and store the value of product and
Carry in memory location.
8) Terminate the program.
PROGRAM:
LXI H, 4150
MOV B , M ; Get the dividend in B – reg.
MVI C, 00 ; Clear C – reg for qoutient
INX H ;
MOV A , M ; Get the divisor in A – reg.
NEXT: CMP B ; Compare A - reg with register B.
JC LOOP ; Jump on carry to LOOP
SUB B ; Subtract A – reg from B- reg.
INR C ; Increment content of register C.
JMP NEXT ; Jump to NEXT
LOOP: STA 4152 ; Store the remainder in Memory
MOV A, C ;
STA 4153 ; Store the quotient in memory
HLT ; Terminate the program.
RESULTS:
Input: FF (4150)
FF (4251)
Output: 01 (4152) ---- Remainder
FE (4153) ----- Quotient
19
EXPERIMENT NO.- 4 (b)
OBJECTIVE:- Write a program to perform division of two 8 bit numbers using bit rotation method.
APPARATUS REQUIRED: -
PROGRAM:
MVI E, 00 H ; Quotient = 0
LHLD 2200 H ; Get Dividend
LDA 2300 H ; Get Divisor
MOV B , A ; Store Divisor
MVI C , 08 H ; Count = 08
NEXT : DAD H ; Dividend = Dividend X 2
MOV A , E
RLC
MOV E , A ; Quotient = X 2
MOV A , H
SUB B ; Is MSB of dividend > divisor
JC SKIP ; No go to next step
MOV H , A ; Yes subtract divisor
INR E ; Quotient = Quotient + 1
SKIP : DCR C ; Count = count – 1
JNZ NEXT ; Is count = 0 repeat
MOV A , E
STA 2401 H ; Store Quotient
MOV A , H
STA 2401 H ; Store Remainder
HLT ; End of program
REULTS:-
Number at 220H is divided from the number at 2300H
20
EXPERIMENT NO.- 5
APPARATUS REQUIRED: -
DESCRIPTION/ALGORITHM:-
Write a program to find the largest number in a given array of 16 elements. The array is stored in
memory from 9200H onwards. Store the result at the end of the array.
FLOWCHART:-
21
RESULT AND INFERENCE:-
The largest number from the array of 16 numbers from memory location 9200H is found out and stored
at 9210H
22
EXPERIMENT NO.- 6
THEORY:- Same as largest no. we compare two number one by one but comparison process is
reverse.
PROCEDURE:-
RESULTS:
Smallest number has been found out from a 16 bit array starting from 9200H and is stored at 9210H.
23
EXPERIMENT NO.- 7
OBJECTIVE:- Interfacing a program to initiate 8251 and to check transmission and reception of
character
APPARATUS REQUIRED: -
DESCRIPTION/ALGORITHM:-
Steps:
1. Intitialize timer IC
2. Move the mode command word to A
3. Output it to port address C2
4. Moce the command instruction word to A reg.
5. Output it to port address C2
6. Move the data to be transferred to A
7. Output it to port address C0
8. Reset the system
9. Get data from input port C0
10. Store the value in memory
11. Reset the system
PROGRAM:
MVI A,36H
Out CEH
MVI A,0AH
Out C8H
LXI H,4200H
MVI A,4EH
Out C2H
MVI A, 37H
Out C2H
MVI A, 42H
Out C0H
RST 1
ORG 4200H
In C0H
STA 4500H
RST 1
RESULT
Output at 4500=1
24
EXPERIMENT NO.- 8
OBJECTIVE:- To interface Programmable Interval timer to 8085 and verify the operation of 8253 in
six different modes
APPARATUS REQUIRED: -
DESCRIPTION/ALGORITHM:-
At first let us see the channel in mode0. Connect the CLK0 to the debounce circuit and execute the
following program.
Program:
MVI A, 30H
OUT CEH
MVI A, 05H
OUT C8H
MVI A, 00H
OUT C8H
HLT
After loading the count, the output will remain low following the rising edge of the gate input.The
output will go high on the terminal count.
The program initializes channel 0 of 8253 in Mode 1 and also initializes triggering of gate.
Program:
MVI A, 32H
OUT CEH
MVI A, 05H
OUT C8H
MVI A,00H
OUT C8H
OUT DOH
HLT
25
Program:
MVI A, 36H
OUT CEH
MVI A, 0AH
OUT C8H
MVI A, 00H
OUT C8H
HLT
RESULT:
Thus the 8253 PIT was interfaced to 8085 and the operations for mode 0, 1 and 3 were verified.
26