Professional Documents
Culture Documents
Lab Manual Micro
Lab Manual Micro
Lab Manual Micro
ECE 315
MICROPROCESSOR BASED SYSTEM
DESIGN LABORATORY
TABLE OF CONTENTS
S. No.
7
8
9
10
Page No.
11
15
17
19
21
23
25
26
Experiment 1
1. Aim: Perform the following using 8085 Simulator and 8085 Microprocessor kit in
assembly language:
i. Write a program to add two 8-bit numbers. (Or) Write a program to add two 16bit numbers.
ii. Write a program to subtract two 8-bit numbers. (Or) Write a program to subtract
two 16-bit numbers.
Equipment required: 8085 microprocessor kit
2. Learning Objective:
a. To acquaint with 8085 microprocessor performance.
b. To determine the addition and subtraction of two numbers.
3. Program
Program ( i.a ):
Program (i.b):
Program ( ii.a):
Program ( ii.b ):
4. Required Results:
Input: 1st number: .
2nd number:
Output: Addition of two numbers: .
Subtraction of two numbers: ..
5. Cautions:
a. Before enter the program press RST key on 8085 kit.
b. Proper care must be taken while handling the microprocessor kit.
6. Learning outcomes: Mathematical operations using 8085 kit.
Experiment 2
1. Aim: Perform the following using 8085 Simulator and 8085 Microprocessor kit in
assembly language:
i. Write a program to multiply two 8 bit numbers by repetitive addition method
(or) write a program to multiply two 8 bit numbers by rotation method.
ii. Write a program to divide 16-bit number by 8-bit number.
Equipment required: 8085 Microprocessor kit.
2. Learning Objective:
a. To acquaint with 8085 microprocessor performance.
b. To determine the division and multiplication of two numbers.
3. Program
Program (i.a):
Program ( i.b):
Program (ii):
MVI E, 00 : Quotient = 0
LHLD 2200H : Get dividend
LDA 2300 : Get divisor
MOV B, A : Store divisor
MVI C, 08 : Count = 8
NEXT: DAD H : Dividend = Dividend x 2
MOV A, E
RLC
MOV E, A : Quotient = Quotient x 2
MOV A, H
SUB B : Is most significant byte of Dividend > divisor
JC SKIP : No, go to Next step
MOV H, A : Yes, subtract divisor
INR E : and Quotient = Quotient + 1
SKIP:DCR C : Count = Count - 1
JNZ NEXT : Is count =0 repeat
MOV A, E
STA 2401H : Store Quotient
Mov A, H
STA 2410H : Store remainder
HLT : End of program.
4. Required Results:
Input: 1st number:
2nd number:
Output: Multiplication of two numbers: .
Division of two numbers: ..
5. Cautions:
a. Before enter the program press RST key on 8085 kit.
b. Proper care must be taken while handling the microprocessor kit.
6. Learning outcomes: Mathematical operations using 8085.
10
Experiment 3
1. Aim: Perform the following using 8085 Simulator and 8085 Microprocessor kit in
assembly language:
i. Finding 1s and 2s complement of an 8-bit number.
ii. Finding 1s and 2s complement of an 16-bit number.
Requirements: 8085 Microprocessor kit.
2. Learning Objective: Complement of a number using 8085 kit.
3. Assembly language:
Program (i.a):
Program (i.b):
11
Explanation:
This program finds the 2s complement of an 8-bit number stored in memory location
3000H.
Let us assume that the operand stored at memory location 3000H is 85H.
The operand is moved to accumulator from memory location 3000H.
Then, its complement is found by using CMA instruction.
One is added to accumulator by incrementing it to find its 2s complement.
The result is stored at memory location 3001H.
Program (ii.a):
Explanation:
This program finds the 1s complement of 16-bit number stored in memory 3000H3001H.
There is no direct way to find 1s complement of 16-bit number. Therefore, this can be
accomplished by finding the 1s complement of two 8-bit numbers.
Let us assume that the operand stored at memory locations 3000H-3001H is 45H-6AH.
The operand is loaded into H-L pair from memory locations 3000H-3001H.
The lower-order is moved from register L to accumulator.
Its complement is found by using CMA instruction.
The result obtained is moved back to register L.
Then, the higher-order is moved from register H to accumulator.
Its complement is found by using CMA instruction.
The result obtained is moved back to register H.
Now, the final result is in H-L pair.
12
Explanation:
4. Required Results:
Input: 8-bit number:
16-bit number:
13
14
Experiment 4
1. Aim: Perform the following using 8085 Simulator and 8085 Microprocessor kit in
assembly language:
i.
.
ii. Split hex data into two nibbles and swap the higher nibble and lower nibble of
that number.
Requirements: 8085 Microprocessor kit.
2. Learning Objective: Swapping of lower and higher nibble of a number.
3. Assembly language
Program ( i ) :
MVI B,00H
MVI C,08H
MOV A,D
BACK:
RAR
JNC SKIP
INR B
SKIP: DCR C
JNZ BACK
HLT
Program ( ii ) :
LDA 2200H ; Get the packed BCD number
ANI F0H
; Mask lower nibble
RRC
RRC
RRC
RRC
; Adjust higher BCD digit as a lower digit
STA 2300H ; Store the partial result
LDA 2200H ; Get the original BCD number
ANI 0FH
; Mask higher nibble
STA 2301H ; Store the result
LDA 2300H ; Get the contents of memory location 2300H into accumulator
MOV B, A ; save the contents in B register
LDA 2301H ; Get the contents of memory location 2301H into accumulator.
STA 2300H ; Store the contents of accumulator at address 2000H.
MOV A, B ; Get the saved contents back into A register
STA 2301H ; Store the contents of accumulator at address 2200H
HLT
; Terminate program execution
15
4. Required Results:
Input: Enter the number:
Output: number of ones in number: .
Result after swapping: .
5. Cautions:
a. Before enter the program press RST key on 8085 kit.
b. Proper care must be taken while handling the microprocessor kit.
6. Learning outcomes: Students will be able to learn mathematical operations using
8085 kit.
16
Experiment 5
1. Aim: Write a program to convert a 2-digit BCD number into its binary equivalent
number.
Requirements: 8085 Microprocessor kit.
2. Learning Objective: BCD to binary conversion of a number.
3. Program:
Sample problem:
(2200H) = 67H
(2300H) = 6 x OAH + 7 = 3CH + 7 = 43H
Sample Program:
LDA 2200H : Get the BCD number
MOV B, A : Save it
ANI OFH : Mask most significant four bits
MOV C, A : Save unpacked BCDI in C register
MOV A, B : Get BCD again
ANI FOH : Mask least significant four bits
RRC : Convert most significant four bits into unpacked BCD2
RRC
RRC
RRC
MOV B, A : Save unpacked BCD2 in B register
XRA A : Clear accumulator (sum = 0)
17
18
Experiment 6
1. Aim: Perform the following using 8085 Simulator and 8085 Microprocessor kit in assembly
language :
i.
ii.
Write a program for displaying BCD down counter. Counter should count numbers from 99 to
00 and it should increment after every 1 sec.
Write a program for displaying binary up counter. Counter should count numbers from 00 to
FFH and it should increment after every 0.5 sec.
3. Program ( i ) :
LXI SP, 27FFH : Initialize stack pointer
MVI C, 99H : Initialize counter = 99
BACK:CALL Display : Call display subroutine
CALL Delay : Call delay subroutine
ADI 99H : See Addition below
DAA : Adjust for decimal
CPI 99H : Compare with last count
JNZ BACK :If no, repeat
HLT
19
Program ( ii ) :
LXI SP, 27FFH : Initialize stack pointer
MVI C, OOH : Initialize counter
BACK: CALL Display : Call display subroutine
CALL Delay : Call delay subroutine
INR C : Increment counter
MOV A, C
CPI OOH : Check counter is > FFH
JNZ BACK : If not, repeat
HLT : Stop
Delay Routine:
Delay: LXI B, count : Initialize count
BACK: DCX D : Decrement count
MOV A, E
ORA D : Logically OR D and E
JNZ BACK : If result is not 0 repeat
RET : Return to main program
4. Cautions:
a. Before enter the program press RST key on 8085 kit.
b. Proper care must be taken while handling the microprocessor kit.
5. Learning outcomes: mathematical operations using 8085.
20
Experiment 7
1. Aim: Interfacing of Seven segment display with 8085 microprocessor.
Requirements: 8085 Microprocessor kit, Seven Segment LED & wires.
2. Learning Objective: Seven segment interfacing using 8085 kit.
3. Circuit Diagram:
4. Program:
MVI A, 80H
OUT CR
K: LXI H, 2000H
MVI B, 10H
KK: MOV A, M
OUT PA
CALL DELAY
INX H
JNZ KK
21
JMP K
HLT
Delay: LXI D, Count
Back: DCX D
MOV A, D
ORA E
JNZ Back
RET
5. Inputs:
2000: 40H, 79H, 24H, 30H, 19H, 12H, 02H, 78H, 00H, 18H, 08H, 03H, 46H, 21H, 06H,
0EH
6. Result:
On the Seven segment LED we can see all the Hexadecimal nos displayed with some
delay as mentioned.
7. Cautions:
a. Before enter the program press RST key on 8085 kit.
b. Proper care must be taken while handling the microprocessor kit.
8. Learning outcomes: Students will be able to learn how to interface seven segment
with 8085.
22
Experiment 8:
1. Aim: Interfacing of D/A converter with 8085 microprocessor to generate RAMP
wave.
Requirements: 8085 Microprocessor Kit, DAC0808, 100nF(2), 1k, Op-Amp 741.
2. Learning Objective: Digital to analog converter interfacing.
3. Circuit Diagram:
4. Program:
MOV A, 80H
OUT CW
MVI A, 00H
KK: OUT PA
CALL DELAY
INC A
JMP KK
RST 5
Delay: LXI D, Count
Back: DCX D
MOV A, D
ORA E
JNZ Back
RET
23
24
Experiment 9
1. Aim: Interfacing and control of stepper motor using 8085 microprocessor.
Requirements: 8085 Microprocessor kit, Stepper Motor, Motor driver circuit
(ULN2003) & wires.
2. Learning Objective: Stepper motor interfacing with 8085.
3. Program:
i) To rotate in Clock Wise direction
MVI A, 80H
OUT CR
MVI A, 44H
KK: OUT PA
CALL DELAY
RRC
JMP KK
RST 5
ii) To rotate in Anti-Clock Wise direction
MVI A, 80H
OUT CR
MVI A, 44H
KK: OUT PA
CALL DELAY
RLC
JMP KK
RST 5
Delay: LXI D, Count
Back: DCX D
MOV A, D
ORA E
JNZ Back
RET
4. Result: Stepper motor rotates in Clock wise & Anti-clock wise direction.
5. Cautions:
a. Before enter the program press RST key on 8085 kit.
b. Proper care must be taken while handling the microprocessor kit.
6. Learning outcomes: Students will be able to learn how to interface and control
stepper motor with 8085.
25
Experiment 10
1. Aim: Design a 8085 Microprocessor based Traffic light control for figure shown
below with the following conditions:
Allow traffic to flow from N to S & S to N for 1sec
Glow all Yellow lights for 0.2sec
Allow traffic to flow from W to E & E to W for 1sec
Glow all Yellow lights for 0.2sec
Make this process continues.
Requirements: 8085 Microprocessor Kit, 9 LEDs, 5K resistors (9)
2. Learning Objective: Traffic light control system using 8085.
3. Circuit Diagram:
4. Program:
MVI A, 80H : Initialize 8255, port A and port B
OUT CR ;(CR) : in output mode
START: MVI A, 09H
OUT PA; (PA) : Send data on PA to glow R1 and R2
MVI A, 24H
OUT PB; (PB) : Send data on PB to glow G3 and G4
MVI C, 28H : Load multiplier count (40) for delay
26
27