Microprocessor & Microcontroller Lab
Microprocessor & Microcontroller Lab
PROGRAMME: B.Tech
SEMESTER /YEAR: 3rd year 5th Semester
SUBJECT CODE: CS592
SUBJECT NAME: Microprocessor & Microcontroller Lab
INSTITUTE OF ENGINEERING
& MANAGEMENT
Sector-V, Salt Lake Electronics Complex
Kolkata - 700 091, West Bengal, India
Microprocessor & Microcontroller Lab Manual (CS592)
CONTENTS
1 INTRODUCTION TO MICROPROCESSOR 8085 3
Aim 3
Architecture of 8085 Microprocessor 3
PIN Description 4
In Enter Program into Trainer Kit 7
How to Execute Program 7
Result 7
2 8085 INSTRUCTION SET 8
Implied Addressing 8
Register Addressing 8
Immediate Addressing 8
Direct Addressing 8
Register Indirect Addressing 8
Combined Addressing Modes 8
Timing Effects of Addressing Modes 9
Instruction Naming Conventions 9
Stack Control Instructions 11
The I/O instructions 11
Machine Control instructions 11
3 LIST OF INSTRUCTIONS (WITH OPCODE AND DESCRIPTION) OF 8085 12
MICROPROCESSOR
4 LIST OF EXEPRIMENTS 15
Addition of Two 8-Bit Numbers 15
Subtraction of Two 8 Bit Numbers 17
Addition of Two 16 Bit Numbers 19
Subtraction of Two 16 Bit Numbers 21
Multiplication of Two 8 Bit Numbers 23
Division of Two 8 Bit Numbers 25
Ascending Order 28
Largest in Array 30
Fibonacci Series 32
Sum of Series of Data 34
Factorial of 8 Bit Number Using Subroutine 37
1’s Complement of An 8 Bit Number 40
2’s Complement of An 8 Bit Number 41
Block Transfer Program 43
Sum of Two BCD Numbers 45
2
Microprocessor & Microcontroller Lab Manual (CS592)
3
Microprocessor & Microcontroller Lab Manual (CS592)
a) Address Bus
1. The pins Ao – A15 denote the address bus.
2. They are used for most significant bit.
b) Address / Data Bus
1. AD0 – AD7 constitutes the address / Data bus.
2. These pins are used for least significant bit.
c) ALE: (Address Latch Enable)
The signal goes high during the first clock cycle and enables the lower order address bits.
4
Microprocessor & Microcontroller Lab Manual (CS592)
d) IO / M
1. This distinguishes whether the address is for memory or input.
2. When these pins go high, the address is for an I/O device.
e) S0 – S1
S0 and S1 are status signal which provides different status and functions.
f) RD
1. This is an active low signal.
2. This signal is used to control READ operation of the microprocessor.
g) WR
1. WR is also an active low signal.
2. Controls the write operation of the microprocessor.
h) HOLD
1. This indicates if any other device is requesting the use of address and data bus.
i) HLDA
1. HLDA is the acknowledgement signal for HOLD.
2. It indicates whether the hold signal is received or not.
j) INTR
1. INTE is an interrupt request signal.
2. IT can be enabled or disabled by using software.
k) INTA
1. Whenever the microprocessor receives interrupt signal
2. It has to be acknowledged.
l) RST 5.5, 6.5, 7.5
1. These are nothing but the restart interrupts.
2. They insert an internal restart junction automatically.
m) TRAP
1. Trap is the only non-maskable interrupt.
2. It cannot be enabled (or) disabled using program.
n) RESET IN
1. This pin resets the program counter to 0 to 1 and results interrupt enable and HLDA flip
flops.
o) X1, X2
These are the terminals which are connected to external oscillator to produce the necessary
and suitable clock operation.
5
Microprocessor & Microcontroller Lab Manual (CS592)
p) SID
This pin provides serial input data
q) SOD
This pin provides serial output data
r) VCC and VSS
1. VCC is +5V supply pin
2. VSS is ground pin
s) Specifications
1. Processors
Intel 8085 at E144 MHz clock
2. Memory
Monitor RAM: 0000 – IFFF
EPROM Expansion: 2000 – 3FFF’s
0000 – FFF
System RAM: 4000 – 5FFF
Monitor data area 4100 – 5FFF
RAM Expansion 6000 – BFFF
3. Input / Output
Parallel: A8 TTL input timer with 2 number of 32-55 only input timer available in
4. Serial: Only one number RS 232-C, Compatible, crucial interface using 8281A
5. Timer: 3 channels-16 bit programmable units, using 8253 channel ‘0’ used for no band
late.
6. Clock generator: Channel ‘1’ is used for single stopping used program.
7. Display: 6 digits – 7 segments LED display with filter 4 digit for adder display and 2
digits for data display.
8. Key board: 21 keys, soft keyboard including common keys and hexa decimal keys.
RES: Reset keys allow terminating present activity and retaining to its on initialize state.
INT: Maskable interrupt connect to CPU’s RST 7.5 interrupt.
DEC: Decrement the adder by 1.
EXEC: Execute line particular value after selecting address through go command.
NEXT: Increment the address by 1 and then display its content.
9. System Power Consumption
Micro BSEB2 MICRO SSEB
+5V @ 1Amp +5V@ 800 mA
+12V @ 200 mA
- 12V @ 100 mA EE0310-Microprocessor & Microcontroller Lab
6
Microprocessor & Microcontroller Lab Manual (CS592)
7
Microprocessor & Microcontroller Lab Manual (CS592)
8
Microprocessor & Microcontroller Lab Manual (CS592)
9
Microprocessor & Microcontroller Lab Manual (CS592)
10
Microprocessor & Microcontroller Lab Manual (CS592)
NZ Not Zero (Z = 0)
Z Zero (Z = 1)
NC No Carry (C = 0)
C Carry (C = 1)
PO Parity Odd (P = 0)
PE Parity Even (P = 1)
P Plus (S = 0)
M Minus (S = 1)
Thus, the conditional branching instructions are specified as follows:
Jumps Calls Returns
JC CC RC (Carry)
JNC CNC RNC (No Carry)
JZ CZ RZ (Zero)
JNZ CNZ RNZ (Not Zero)
JP CP RP (Plus)
JM CM RM (Minus)
JPE CPE RPE (Parity Even)
JP0 CPO RPO (Parity Odd)
Two other instructions can affect a branch by replacing the contents or the program counter:
PCHL Move H & L to Program Counter
RST Special Restart Instruction Used with Interrupts
Stack Control Instructions
The following instructions affect the Stack and/or Stack Pointer:
PUSH Push Two bytes of Data onto the Stack
POP Pop Two Bytes of Data off the Stack
XTHL Exchange Top of Stack with H & L
SPHL Move content of H & L to Stack Pointer
The I/O instructions
IN Initiate Input Operation
OUT Initiate Output Operation
Machine Control instructions
EI Enable Interrupt System
DI Disable Interrupt System
HLT Halt
NOP No Operation
11
Microprocessor & Microcontroller Lab Manual (CS592)
12
Microprocessor & Microcontroller Lab Manual (CS592)
13
Microprocessor & Microcontroller Lab Manual (CS592)
14
Microprocessor & Microcontroller Lab Manual (CS592)
LIST OF EXEPRIMENTS
ADDITION OF TWO 8-BIT NUMBERS
Aim: Write 8085 assembly language program for addition of two 8-bit numbers.
Theory : Consider the first number 42H is stored in memory location 8000H and the second
number 35H is stored in memory location 8001H. The result after addition of two numbers is to
be stored in the memory location 8002 H. Assume program starts from memory location 8500H.
Algorithm
1. Initialize the memory location of first number in HL register pair
2. Move first number/data into accumulator
3. Increment the content of HL register pair to initialize the memory location of second data
4. Add the second data with accumulator
5. Store the result in memory location 8003H
Program
Memory
Machine Codes Mnemonics Comments
address
8500 21 LXI H, 8000 H Address of first number in H-L
8501 00 register pair.
8502 80
8503 7E MOV A,M Transfer first number in accumulator.
8504 23 INX H Increment content of H-L register pair
8505 66 ADD M Add first number and second number
8506 32 STA 8003H Store sum in 8003 H
8507 03
8508 80
8509 76 HLT Halt
Experimental Results
15
Microprocessor & Microcontroller Lab Manual (CS592)
Calculation
Data 1: 42 - 0100 0010
Data 2: 35 - 0011 0101
Sum: 77 – 01110111
Carry: 00
Conclusion
The addition of two 8-bit numbers is performed using 8085 microprocessor where sum is 8-bit.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions
1. What is the function of LXI H, 8000 H instruction?
2. How you can store a data in a memory location?
3. How you can read a data from a memory location?
4. What are flags available in 8085?
5. What is the function of RESET key of an 8085 microprocessor kit?
16
Microprocessor & Microcontroller Lab Manual (CS592)
Theory : Consider the first number 55H is stored in memory location 8000H and the second
number 32H is stored in memory location 8001H. The result after subtraction of two numbers is
to be stored in the memory location 8002H. Assume program starts from memory location
8500H.
Algorithm
1. Initialize the memory location of first number in HL register pair
2. Move first number/data into accumulator
3. Increment the content of HL register pair to initialize the memory location of second data
4. Subtract the second data with accumulator
5. Store the result in memory location 8003H
Program
Memory
Machine Codes Mnemonics Comments
address
8500 21 LXI H, 8000 H Address of first number in H-L register
8501 00 pair.
8502 80
8503 7E MOV A,M Transfer first number in accumulator.
8504 23 INX H Increment content of H-L register pair
8505 66 SUB M Subtract first number and second number
Memory
Machine Codes Mnemonics Comments
address
8506 32 STA 8003H Store sum in 8003 H
8507 03
8508 80
8509 76 HLT Halt
Experimental Results
Input Data Result
Memory location Data Memory location Data
8000 55H 8003 23H
8001 32H
17
Microprocessor & Microcontroller Lab Manual (CS592)
Calculation
Data 1: 55 -0101 0101
Data 2: 32 -0011 0010
Difference: 23 -0010 0011
Borrow: 00
Conclusion
Subtraction of two 8-bit numbers is performed using 8085 microprocessor where sum is 8-bit.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions
1. What is the function of LXI H, 8000 H instruction?
2. How you can store a data in a memory location?
3. How you can read a data from a memory location?
4. What are flags available in 8085?
5. What is the function of RESET key of an 8085 microprocessor kit?
18
Microprocessor & Microcontroller Lab Manual (CS592)
Theory: Consider the first number 4283H is stored in memory location 8000H and 8001H; the
second number 2931H is stored in memory location 8002H and 8003H. The result after addition
of two numbers is to be stored in the memory location 8004H and 8005H. Assume program starts
from memory location 8500H.
Algorithm
1. Start the microprocessor
2. Get the 1st 8 bit in ‘C’ register (LSB) and 2nd 8 bit in ‘H’ register (MSB) of 16 bit number.
3. Save the 1st 16 bit in ‘DE’ register pair
4. Similarly get the 2nd 16 bit number and store it in ‘HL’ register pair.
5. Get the lower byte of 1st number into ‘L’ register
6. Add it with lower byte of 2nd number
7. Store the result in ‘L’ register
8. Get the higher byte of 1st number into accumulator
9. Add it with higher byte of 2nd number and carry of the lower bit addition.
10. Store the result in ‘H’ register
11. Store 16 bit addition value in ‘HL’ register pair
12. Stop program execution
Program
Memory
Label Mnemonics Hex Code Comments
address
8500 MVI C,00 0E C = 00H
8501 00
8502 LHLD 8000 2A HL – 1st No.
8503 00
8504 80
8505 XCHG EB HL – DE
8506 LHLD 8002 2A HL – 2nd No.
8507 02
8508 80
8509 DAD D 19 Double addition DE + HL
850A JNC Ahead D2 If Cy = 0, G0 to 850E
850B 0E
19
Microprocessor & Microcontroller Lab Manual (CS592)
Memory
Label Mnemonics Hex Code Comments
address
850C 85
850D INR C 0C C = C + 01
850E AHEAD SHLD 8004 22 HL –8004 (sum)
850F 04
8510 80
8511 MOV C,A 79 Cy – A
8512 STA 8006 32 Cy – 8006
8513 06
8514 80
8515 HLT 76 Stop execution
Experimental Results
Conclusion
Addition of two 16-bit numbers is performed using 8085 microprocessor where sum is 16-bit.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions
1. What is the function of XCHG instruction?
2. How you can store a data in a memory location?
3. How you can read a data from a memory location?
4. What are flags available in 8085?
5. What is the function of DAD, LHLD and SHLD instructions of 8085 microprocessor?
20
Microprocessor & Microcontroller Lab Manual (CS592)
21
Microprocessor & Microcontroller Lab Manual (CS592)
Conclusion
The subtraction of two 16-bit numbers is performed using 8085 microprocessor where result is
16-bit.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions
1. What is the function of XLHG instruction?
2. How you can store a data in a memory location?
3. How you can read a data from a memory location?
4. What are flags available in 8085?
5. What is the function of SBB, LHLD instructions of 8085 microprocessor?
22
Microprocessor & Microcontroller Lab Manual (CS592)
23
Microprocessor & Microcontroller Lab Manual (CS592)
Experimental Results
Calculation
05 - 0000 0101
+ 05 -0000 0101
----- 0A - 0000 1010
+ 05 -0000 0101
= 0F - 0000 1111
Conclusion
The multiplication of two 8-bit numbers is performed using 8085 microprocessor where result is
16-bit.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions
1. What is the function of DAD instruction?
2. How you can store a data in a memory location?
3. How you can read a data from a memory location?
4. What are flags available in 8085?
5. What is the function of SHLD instruction of 8085 microprocessor?
24
Microprocessor & Microcontroller Lab Manual (CS592)
Aim: To write an assembly language program for dividing two 8 bit numbers using
microprocessor kit.
Theory: Consider the first number 09H is stored in memory location 8000H AND the second
number 02H is stored in memory location 8001H. The result after division of two numbers is to
be stored in the memory location 8002H (quotient) and 8003H (remainder). Assume program
starts from memory location 8500H.
Algorithm
1. Start the microprocessor
2. Initialize the Quotient as zero
3. Load the 1st 8 bit data
4. Copy the contents of accumulator into register ‘B’
5. Load the 2nd 8 bit data
6. Compare both the values
7. Jump if divisor is greater than dividend
8. Subtract the dividend value by divisor value
9. Increment Quotient
10. Jump to step 7, till the dividend becomes zero
11. Store the result (Quotient) value in accumulator
12. Move the remainder value to accumulator
13. Store the result in accumulator
14. Stop the program execution
Program
Memory
Label Mnemonics Hex Code Comments
address
8500 MVI C, 00 0E Initialize Quotient as
8501 00 zero
8502 LDA 8000 3A
Get the first number in
8503 00
Accumulator
8504 80
8505 MOV B,A 47 Copy the 1st data into
register B
25
Microprocessor & Microcontroller Lab Manual (CS592)
Memory
Label Mnemonics Hex Code Comments
address
8506 LDA 8001 3A Get the second number
8507 01 in Accumulator
8508 80
8509 CMP B B8 Compare the 2 values
850A JC LOO DA
P1 Jump if dividend lesser
850B 12 than divisor
850C 85
850D LOOP2 SUB B 90 Subtract the 1st value
by 2nd value
Experimental Results
Input Data Result
Memory location Value Memory location Value
8000 09 8002 04 (quotient)
8001 02 8003 01 (reminder)
Calculation
1001
0010 – I
------
0111
0010 – II
------
0101
0010 – III
26
Microprocessor & Microcontroller Lab Manual (CS592)
------
0011
0010 – IV
------
0001 – carry
Quotient - 04
Carry - 01
Conclusion
The division of two 8-bit numbers is performed using 8085 microprocessor where result is 8 bit
number quotient and 8 bit number remainder.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions
1. What is the function of CMP instruction?
2. How you can store a data in a memory location?
3. How you can read a data from a memory location?
4. What are flags available in 8085?
5. What is the function of JMP and JC instructions of 8085 microprocessor?
27
Microprocessor & Microcontroller Lab Manual (CS592)
ASCENDING ORDER
Theory: A series of five words 04, AB, BC, 01,0A in memory locations from 8000 to 8004 and
number of words is stored in memory location 17B3:0300. Arrange the above words in
Descending Order.
Algorithm
Program
Memory
Label Mnemonics Hex Code Comments
address
8500 LDA 8000 3A
8501 00 Load the number of values
8502 80
8503 MOV B,A 47 Move it ‘B’ register
8504 DCR B 05 For (N-1) comparisons
8505 Loop 3 LXI H, 8000 21
8506 00 Set the pointer for array
8507 80
8508 MOV C,M 4E Count for (N-1) comparisons
8509 DCR C 0D For (N-1) comparisons
850A INX H 23 Increment pointer
850B Loop 2 MOV A,M 7E Get one data in array ‘A’
850C INX H 23 Increment pointer
850D CMP M BE Compare next with accumulator
28
Microprocessor & Microcontroller Lab Manual (CS592)
Memory
Label Mnemonics Hex Code Comments
address
850E JC Loop1 DA
850F 16 If content less memory go ahead
8510 85
8511 MOV D,M 56 If it is greater than interchange it
8512 MOV M,A 77 Memory content
8513 DCX H 2B Exchange the content of memory
pointed by ‘HL’ by previous location
8514 MOV M,D 72 One in by ‘HL’ and previous location
8515 INX H 23 Increment pointer
8516 Loop 1 DCR C 0D Decrement ‘C’ register
8517 JNZ Loop 1 C2
8518 0B Repeat until ‘C’ is zero
8519 85
851A DCR B 05 Decrement in ‘B’ values
851B JNZ Loop 2 C2
851C 05 Repeat till ‘B’ is zero
851D 80
851E HLT 76 Stop the program execution
Experimental Results
Conclusion
The above assembly language program for sorting numbers in ascending order was executed by
microprocessor kit and this program is stored into memory 8500 to 851E.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions
1. What do you mean by ascending order?
2. What is the function of CMP, LXI instructions?
3. How you can store the smallest number in memory?
29
Microprocessor & Microcontroller Lab Manual (CS592)
LARGEST IN ARRAY
Aim: To find the largest element in an array of size ‘n’ using 8085 Microprocessor.
Theory: Find the largest number in a block of data. The length of the block is in memory
location 8000H and the block itself starts from memory location 8001H. Store the maximum
number in memory location 8050H. Assume that the numbers in the block are all 8 bit unsigned
binary numbers.
Algorithm
1. Initialize counter
2. Maximum = Minimum possible value = 0
3. Initialize pointer
4. Is number> maximum
5. Yes, replace maximum
6. Decrement counter by one
7. Go to step 4 until counter = 0
8. Store maximum number
9. Terminate program execution
Program
Memory
Label Mnemonics Hex Code Comments
address
8500 LDA 8000 3A
8501 00 Load the number of values
8502 80
8503 MOV C,A 79 Initialize counter
8504 XRA A AF Clear Accumulator
8505 LXI H, 8001 21
8506 01 Set the pointer for array
8507 80
8508 BACK CMP M BD Is number> maximum
8509 JNC SKIP D2 No, jump to SKIP
850A 0D
850B 85
850C MOV A,M 7E replace maximum
850D SKIP INX H 23 Increment pointer
850E DCR C 0D Decrement counter by one
850F JNZ BACK C2
8510 08 Go to next iteration
8511 85
30
Microprocessor & Microcontroller Lab Manual (CS592)
Memory
Label Mnemonics Hex Code Comments
address
8512 STA 8050 32
8513 50 Store maximum number
8514 80
8515 HLT 76 Terminate program execution
Experimental Results
Conclusion
Program to find the smallest element in an array of size ‘n’ using 8085 Microprocessor has been
executed.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions
1. What do you mean by XRA A?
2. What is the function of CMP, LXI, JNC, JNZ instructions?
3. How you can store the largest number in memory?
31
Microprocessor & Microcontroller Lab Manual (CS592)
FIBONACCI SERIES
Aim: To write an assembly language program to display ‘n’ elements of the Fibonacci series
using 8085 Microprocessor.
Theory: Find the Fibonacci series, where the length of the series is in memory location 8000H
and the series itself starts from memory location 8001H.
Algorithm
1. Start the microprocessor
2. Load the length of series in the accumulator and decrement it by 2
3. Move the value to register ‘D’
4. Load the starting value of data value address
5. Initialize the 1st number as 00
6. Move the pointer to 2nd data and initialize them as ‘01’
7. Move the pointer to next position for next data
8. Initialize B as ‘00’ and C as ‘01’ for calculations
9. Copy the contents of ‘B’ to accumulator
10. Add the content of ‘C’ register to accumulator
11. Move the content ‘C’ to ‘B’ and ‘A’ to C
12. Now store the result to memory pointed by ‘HL’ pair
13. Move the pointer to next pointer
14. Decrement 0 by 1 for counter
15. If ‘D’ is not zero, go to step 9
16. If ‘D’ is zero, end the program
Program
Memory
Label Mnemonics Hex Code Comments
address
8500 LDA 8000 3A
8501 00 Store the length of series in ‘A’
8502 80
8503 SUI 02 D6
Decrement ‘A’ by 02
8504 02
8505 MOV D,A 57 Move ‘A’ to ‘D’ (counter)
8506 LXI H, 8001 21
8507 01 Load the starting address of array
8508 80
8509 MVI M,00 36
Initialize 8001 as ‘00’
850A 00
32
Microprocessor & Microcontroller Lab Manual (CS592)
Memory
Label Mnemonics Hex Code Comments
address
850B INX H 23 Increment pointer
850C MVI M, 01 36
Initialize 2nd as ‘01’
850D 01
850E INX H 23 Increment pointer
850F MVI B,00 06
Initialize ‘B’ as ‘00’
8510 00
8511 MVI, C, 01 0E
Initialize ‘C’ as ‘01’
8512 01
8513 Loop MOV A,B 78 Move B to A
8514 ADD C 81 Add ‘A’ and ‘C’
8515 MOV B,C 41 Move C to B
8516 MOV C,A 4F Move A to C
8517 MOV M,A 77 Move the result to memory
8518 INX H 23 Increment pointer
8519 DCR D 15 Decrement counter
851A JNZ Loop C2
851B 13 If D = 0, jump to loop
851C 80
851D HLT 76 Stop the program
Experimental Results
Input Data Result
Input Address Value Output Address Value
8000 05 8001 00
8002 01
8003 01
8004 02
8005 03
Conclusion
The assembly language for Fibonacci series was executed successfully using 8085
microprocessor kit.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions
1. What do you mean by SUI?
2. What is the function of LXI, JNC, JNZ instructions?
3. How you can store the series in memory?
33
Microprocessor & Microcontroller Lab Manual (CS592)
Algorithm
1. Start the microprocessor
2. Load the number of values in series in accumulator and move it to register C and load the
starting address of array
3. Initialize the value of A as ‘00’
4. Move the value of ‘A’ to ‘B’ register
5. Add the content of accumulator with the data pointed by ‘HL’ pair
6. If there exists a carry, increment ‘B’ by 1, if not continue
7. Increment the pointer to next data
8. Decrement the value of ‘C’ by 1, which is used as counter
9. If ‘C’ is equal to zero, go to step 10 if not go to step 5.
10. Store the value of ‘A’ to memory, it shows the result
11. Move the content of B to A
12. Store the value of A to memory
13. Stop the program
Program
Memory
Label Mnemonics Hex Code Comments
address
8500 LDA 8000 3A
8501 00 Load accumulator with number of values
8502 80
8503 MOV B,A 4F Move it from A to C
8504 LXI H, 8001 21
8505 01 Load the starting address of data array
8506 80
8507 SUB A 97 Initialize ‘A’ as 00
8508 MOV B,A 47 Initialize ‘B’ as 00
8509 Loop ADD M 86 Add the previous sum with next data
34
Microprocessor & Microcontroller Lab Manual (CS592)
Memory
Label Mnemonics Hex Code Comments
address
850A JNC Skip D2
850B 0E Jump on if no carry
850C 85
850D INR B 04 Increment carry by one
850E Skip INX H 23 Increment pointer for next data
850F DCR C 0D Decrement ‘C’ by one
8510 JNZ Loop C2
8511 09 Jump if not zero
8512 85
8513 STA 8050 32
8514 50 Store the sum in accumulator
8515 80
8516 MOV A,B 78 Move the value of carry to A from B
8517 STA 8051 32
8518 51 Store the carry in memory
8519 80
851A HLT 76 End of program
Experimental Results
Calculation
07 + 09 + 03 + 04 = 23
= 17 (in Hexa decimal)
(0F + 8 = 233)
0F = 0000 1111
08 = 0000 1000
---------------
0001 0111
17
35
Microprocessor & Microcontroller Lab Manual (CS592)
Conclusion
The assembly language program for sum of data was executed successfully using 8085
microprocessor kit.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions
1. What do you mean by carry?
2. What is the function of LXI, JNC, JNZ instructions?
3. How you can store the series in memory?
36
Microprocessor & Microcontroller Lab Manual (CS592)
Theory: This program finds the factorial of a number stored in 8000H memory location. The
result is stored in memory location 8050H.
Algorithm:
Program
Memory Address Label Hex Code Mnemonics Comments
8500 3A LDA 8000 Get the number in
8501 00 accumulator
8502 80
8503 FE CPI 02H Compare data with 2 and
8504 02 check it is greater than 1
8505 DA JC Loop 1 If cy =1 jump to loop 1
8506 17 If cy = 0 proceed
8507 85
8508 5F MOV E,A Move content of A to E
8509 16 MVI D,00 Load this term as a result
850A 00
850B 3D DCR A Decrement accumulator by 1
850C 4F MOV C,A Move ‘A’ content to ‘C’
(counter 1 less than A)
37
Microprocessor & Microcontroller Lab Manual (CS592)
Experimental Results
38
Microprocessor & Microcontroller Lab Manual (CS592)
Conclusion
The assembly language program for factorial of 8 bit number was executed successfully using
8085 microprocessor kit.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions
39
Microprocessor & Microcontroller Lab Manual (CS592)
Conclusion
The one’s complement of an 8-bit numbers is performed using 8085 microprocessor.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions:
1. Define one’s complement of an 8-bit numbers.
2. What is the function of CMA instruction?
40
Microprocessor & Microcontroller Lab Manual (CS592)
Aim: Write 8085 assembly language program for two’s complement of an 8-bit numbers
Theory: The number is stored in memory location 8000H. The two’s complement will be stored
in 8050H. The program is written from memory location 8500H.
Algorithm
1. Transfer the content of memory location 8500H to accumulator.
2. Complement the content of accumulator
3. Add 01H with accumulator to get two’s complement of number
4. Store the result in memory location 8501H
Program
Experimental Results
Conclusion:
The two’s complement of an 8-bit numbers is performed using 8085 microprocessor.
41
Microprocessor & Microcontroller Lab Manual (CS592)
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions:
1. Define two’s complement of an 8-bit numbers.
2. What is the function of CMA instruction?
3. Why ADI 01H is used in two’s complement of an 8-bit number.
42
Microprocessor & Microcontroller Lab Manual (CS592)
43
Microprocessor & Microcontroller Lab Manual (CS592)
Experimental Results
Conclusion:
The block transfer is performed using 8085 microprocessor.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions:
1. Define block transfer.
2. What is the function of STAX instruction?
3. Why INX H and INX D is used?
44
Microprocessor & Microcontroller Lab Manual (CS592)
Aim: To perform addition of two 8-bit BCD numbers using 8085 microprocessor.
Theory: The two numbers in BCD are stored in memory locations 8000H and 8001H
respectively. This program adds these two BCD numbers and stores the results in memory
locations 8003H and 8004H.
Algorithm
1. Load Data 1 into Accumulator
2. Move Accumulator contents to B
3. Load Data 2 into accumulator
4. Add Data1 and Data2 and store into Accumulator
5. Convert the accumulator value to BCD value
6. Store Accumulator content (Result) to memory
Program
45
Microprocessor & Microcontroller Lab Manual (CS592)
Memory
Hex Code Label Mnemonics Comments
Address
8512 79 MOV A,C Move contents of C to Accumulator
8513 32 STA 8004
Store Register C (Carry) content to
8514 04
memory
8515 80
8516 76 HLT End of program
Experimental Results
Calculation
Input 1: 13 0001 0011
Input22: 4A 0100 1010
Gives 0101 1101
After adding 06 0000 0110
Result: 63 0110 0011
Carry: 00
Conclusion:
The BCD addition is performed using 8085 microprocessor successfully.
Precautions
1. Properly connect the 8085 microprocessor kit with power supply terminals.
2. Switch on the power supply after checking connections.
3. Handle the Trainer kit carefully.
Viva-Voice Questions:
1. How BCD number store in memory?
2. What is the function of DAA instruction?
3. How you can store the results in memory?
46