G.L.
BAJAJ INSTITUTE OF TECHNOLOGY & MANAGEMENT
GREATER NOIDA
MICROPROCESSOR &
MICROCONTROLLER LAB (KEC-552)
LAB MANUAL
ACADEMIC SESSION 2021-22
COURSE : B.TECH (ECE)
SEM: V
Dept. of Electronics & Communication Engineering
G. L. BAJAJ INSTITUTE OF TECHNOLOGY AND MANAGEMENT
Plot no. 2, Knowledge Park III, Gr. Noida
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 1
Vision
To become a department of repute and prepare globally competent and socially responsible
professionals with holistic knowledge and technical skills.
Mission
M1:To provide a supportive environment for effective knowledge transfer and nurturing ideas.
M2:To equip students with technical and leadership skills, and abilities to face the global
challenges.
M3:To create an environment conducive for research and development with continuous
involvement of industry.
M4:To inculcate professional and moral values in the students.
PROGRAM EDUCATIONAL OBJECTIVES
On completion of this course, our graduates will be able to
1. Exhibit multi-disciplinary technical and leadership skills for better employability, higher
education and entrepreneurship.
2. Possess strong knowledge in the field of Electronics and Communication Engineering to
develop solutions for real life problems.
3. Undertake professional responsibilities through strong team-work, communication skills and
life-long learning.
4. Become socially responsible professionals with moral values and ethics.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 2
PROGRAMME OUTCOMES
OUTCOMES(POs) Engineering Graduates will be ableto:
1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering fundamentals, and
an engineering specialization to the solution of complex engineering problems.
2. Problem analysis: Identify, formulate, review research literature, and analyze complex engineering
problems reaching substantiated conclusions using first principles of mathematics, natural sciences, and
engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and design
system components or processes that meet the specified needs with appropriate consideration for the
public health and safety, and the cultural, societal, and environmental considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research methods
including design of experiments, analysis and interpretation of data, and synthesis of the information to
provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with an
understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess societal,
health, safety, legal and cultural issues and the consequent responsibilities relevant to the professional
engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering solutions in
societal and environmental contexts, and demonstrate the knowledge of and need for sustainable
development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and norms of the
engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in diverse
teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the engineering
community and with society at large, such as, being able to comprehend and write effective reports and
design documentation, make effective presentations, and give and receive clear instructions.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 3
11. Project management and finance: Demonstrate knowledge and understanding of the engineering and
management principles and apply these to one’s own work, as a member and leader in a team, to
manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.
Program Specific Outcomes. (PSOs)
PSO1: Design embedded solutions for existing problems of society and industry.
PSO2: Design and test systems in the field of Communications Systems and Networks.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 4
COURSE OUTCOMES
KEC552.1 Use techniques, skills, modern engineering tools, instrumentation and
software/hardware appropriately to list and demonstrate arithmetic and logical operations on 8
bit data using microprocessor 8085.
KEC552.2. Examine 8085 & 8086 microprocessor and its interfacing with peripheral devices.
KEC552.3. State various conversion techniques using 8085 & 8086 and generate waveforms
using 8085.
KEC552.4. Implement programming concept of 8051 Microcontroller.
KEC552.5. Design concepts to Interface peripheral devices with Microcontroller so as to design
Microcontroller based projects.
CO – PO Mapping
PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
KEC 553.1
1 2 2 - 3 - - 1 2 1 - 1 2 -
KEC 553.2
3 3 3 1 3 - - - 2 1 - 1 2 -
KEC 553.3
3 2 2 - 3 - - - 2 1 - 1 2 -
KEC 553.4
3 3 2 1 3 - - - 2 1 - 1 2 -
KEC 553.5
3 3 3 2 3 2 2 1 3 1 2 1 2 -
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 5
Programs List
Note: In addition, institutes may include two more experiments based on the expertise.
15. To convert two BCD numbers in memory to the equivalent HEX number and vice versa
using 8085.
16. Write a program to displace Fibonacci Series using 8085
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 6
INDEX
Name of Experiment INDEX Associated Page
S.No.
COs No.
Write a program using 8085 Microprocessor for Decimal, Hexadecimal
1 CO1
addition and subtraction of two Numbers.
Write a program using 8085 Microprocessor for addition and subtraction
2 CO1
of two BCD numbers.
To perform multiplication and division of two 8 bit numbers using 8085.
3 CO1
To find the largest and smallest number in an array of data using 8085
4 C01
instruction set.
To write a program using 8086 to arrange an array of data in ascending
5 CO2
and descending order.
To convert given Hexadecimal number into its equivalent ASCII
6 number and vice versa using 8086 instruction set. CO2
To convert given Hexadecimal number into its equivalent BCD number
7 CO2
and vice versa using 8086 instruction set.
To interface 8253 programmable interval timer and verify the operation
8 of 8253 in six different modes. CO2
To write a program to initiate 8251 and to check the transmission and
9 reception of character. CO2
Serial communication between two 8085 through RS-232 C port
10 CO3
Write a program of Flashing LED connected to port 1 of the 8051 Micro
11 CO5
Controller
Write a program to generate 10 kHz square wave using 8051.
12 CO4
13 Write a program to show the use of INT0 and INT1 of 8051. CO4
Write a program for temperature & to display on intelligent LCD
14 CO5
display.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 7
INTRODUCTION
8085 MICROPROCESSOR
Internal Architecture
a) General purpose register
It is an 8 bit register i.e. B, C, D, E, H, I... The combination of an 8 bit registers
pair, which can hold 16 bit data. The HL pair is used to act as memory pointer is
accessible to program.
b) Accumulator
It is an 8 bit register which hold one of the data to be processed by ALU and stored
the result of the operation
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 8
c) Program counter ( PC )
It is a 16 bit pointer which maintains the address of byte entered to line stack.
d) Stack pointer ( SP )
It is a 16 bit special purpose register which is used to hold line memory address
for line next instruction to be execution.
e) Arithmetic and logical unit (ALU)
It carries out arithmetic and logical operation by 8 bit address it uses the
accumulator content as input the ALU result is stored back into accumulator.
f) Temporary register
It is an 8 bit register associated with ALU hold data, entering an operation,
used by the microprocessor and not accessible to programs.
g) Flags
Flag register is a group of fire, individual flip flop line content of line flag
register will change after execution of arithmetic and logic operation. The line stages
flags are
i. Carry flag (C)
ii. Parity flag (P)
iii. Zero flag(Z)
iv. Auxiliary carry flag(AC)
v. Sign flag(S)
h) Timing and control unit
Synchronous all microprocessor, operation with clock and generator and control signal
from it necessary to communicate between controller and peripherals.
i) Instruction register and decoder
Instruction is fetched from line memory and stored in line instruction register
decoder the stored information.
j) Register Array
These are used to store 8 bit data during execution of some instruction.
PIN DESCRIPTION OF 8085
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 9
Address Bus
1. The pins A0 – A15 denote the address bus.
2. They are used for most significant bit.
Address / Data Bus
1. AD0 – AD7 constitutes the address / Data bus
2. These pins are used for least significant bit
ALE: (Address Latch Enable)
1. The signal goes high during the first clock cycle and
Enables the lower address bits.
IO / M
1. This distinguishes whether the address is for
Memory or input
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 10
2. When these pins go high, the address is for an I/O device.
S0 – S1
S0 and S1 are status signal which provides different status and Functions.
RD
1. This is an active low signal
2. This signal is used to control READ operation of the
Microprocessor
WR
1. WR is also an active low signal.
2. Controls the write operation of the microprocessor.
HOLD
1. This indicates if any other device is requesting the use of address and data bus.
HLDA
1. HLDA is the acknowledgement signal for HOLD.
2. It indicates whether the HOLD signal is received or not.
INTR
1. INTR is an interrupt request signal.
2. It can be enabled or disabled by using software
INTA
1. Whenever the microprocessor receives interrupt signal.
2. It has to be acknowledged.
RST 5.5, 6.5, 7.5
1. These are nothing but the restart interrupts.
2. They insert an internal restart junction automatically.
TRAP
1. TRAP is the only non-maskable interrupt.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 11
2. It cannot be enabled (or) disabled using program.
RESET IN
1. This pin resets the program counter to 0 to 1 and result interrupts enabled and HLDA flip
flops.
X1, X2
These are the terminals which are connected to external oscillator to produce the
necessary and suitable clock operation.
SID
This pin provides serial input data.
SOD
This pin provides serial output data.
Vcc and Vss
1. Vcc is +5V supply pin.
2. Vss is ground pin.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 12
Execution Steps
1. How to Enter Program into Trainer Kit
1. Press ‘RESET’ key
2. Press ‘REL EXMEM’
3. Enter the starting address (16 bit) of program
4. Press ‘MEMC NEXT’
5. Enter the HEX code
6. Again press ‘MEMC NEXT’
7. Repeat step 5 and 6 till end.
2. How to execute the program
1. Press ‘RESET ’
2. Press ‘GO’
3. Entre the starting address of program.
4. Press ‘.FILL’ key.
5. E display means program executed.
3. Data Feeding
1. Press ‘RESET’
2. Press ‘REL EXMEM’
3. Enter the starting address (16 bit )of data
4. Press ‘MEMC NEXT’ key
5. Countinue data feeding using MEMC NEXT key
4. For Result Checking
1. Press ‘RESET’
2. Press ‘REL EXMEM’
3. Enter the starting address (16 bit) of result
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 13
EXPERIMENT NO. 1a
AIM: Write a program to adding two 8 bit hexadecimal numbers using 8085.
APPARATUS REQUIRED:
S. No. Name of Specification/ Range/ Quantity
Equipment/Software/Components Rating
1. 8085 Microprocessor programming SCIENTECH-8085 01
kit, instruction coding sheet.
2. Power supply A.C (230V Mains)
ALGORITHM:-
HEXADECIMAL ADDITION : Write a program to takes the content of 200A, 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: (200A H) = 80 H
(200B H) = 15 H
Result = 80 H + 15 H = 95 H
(200A H) A
A B
(200B H) A
A + B A
A (200C H)
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 14
FLOWCHART : -
Start
Get the 1st no.
Get the 2nd no.
Add two no.
Store the result
END
PROGRAM:-
Memory Label Mnemonics Remarks
location
2000 LXI H, 200A point 1st no.
2003 MOV A, M Load the acc.
2004 INX H Advance Pointer
2005 ADD M add 2nd no.
2006 INX H Advance Pointer
2007 MOV M, A Store Result
2008 RST 5
2 nd METHOD:-
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 15
Memory Label Mnemonics Remarks
location
2000 LDA 200A Load the acc.
2003 MOV B,A COPY A TO B
2004 LDA 200B Load accumulator
2007 ADD B A+B=A
2008 STA 200C A=200C
20OB RST 5
RESULTS:- Input at 3000= 80H
Input at 3001= 15H
onput at 3002= 95H
CONCLUSION:-
Addition of two 8 bit hexadecimal no is done successfully.
PRECAUTION:-
1.verify the hex code before executing in program
2. Memory location varies as per kit
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 16
EXPERIMENT NO. 1b
AIM: Write a program to Subtraction of two 8 bit hexadecimal numbers by using
microprocessor kit.
APPARATUS REQUIRED:
S. No. Name of Specification/ Range/ Quantity
Equipment/Software/Components Rating
1. 8085 Microprocessor programming SCIENTECH-8085 01
kit, instruction coding sheet.
2. Power supply A.C (230V Mains)
ALGORITHM:-
HEXADECIMAL SUBTRACTION : The program takes the content of 2009, subtracts it to 200A &
stores the result back at 200B.
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
Get the 1st no.
Get the 2nd no.
Sub. second no.
Store the result
END
PROGRAM:-
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 17
Memory Label Mnemonics Remarks
location
2000 LXI H, 200A point 1st no.
2003 MOV A, M Load the acc.
2004 INX H Advance Pointer
2005 SUB M Subtract 2 nd no.
2006 INX H Advance Pointer
2007 MOV M, A Store Result
2008 RST 5
RESULTS:- Input at 3000= 04H
Input at 3001= 02H
output at 3002= 02H
CONCLUSION:-
Subtraction of two 8 bit hexadecimal number is done successfully.
PRECAUTION:-
1.verify the hex code before executing in program
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 18
Viva Questions:
Q.1.Write a small program to enter a data to accumulator and move it to all registers.
Q2. What is the functionality of LXI instruction in the above program?
Q3.In above program why MOV A,M instruction is used if direct instruction LDA, address is
available.
Q4.What are the contents of all flags after execution of program for addition.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 19
EXPERIMENT No.2a
AIM: Write a program to addition of two 8-bit BCD numbers.
APPARATUS REQUIRED:
S. No.
Name of Specification/ Range/ Quantity
Equipment/Compnents/Software Rating
1. 8085 Microprocessor SCIENTECH-8085 01
programming kit, instruction
coding sheet.
2. Power supply A.C (230V Mains)
ALGORITHM:-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
Get the 1st no.
Get the 2nd no.
Add the two numbers
Adjust the decimal
Store the result
END
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 20
PROGRAM:-
Memory Label Mnemonics Remarks
location
2000 LXI H, 200A point 1st no.
2003 MOV A, M Load the acc.
2004 INX H Advance Pointer
2005 ADD M Add 2nd no.
2006 DAA Decimal adjust
2007 INX H Advance Pointer
2008 MOV M, A Store Result
RST 5
RESULTS:- Input at 3000= 54
Input at 3001= 32
output at 3002= 86
CONCLUSION:-
Addition of two 8 bit BCD no is done successfully.
PRECAUTION:-1.verify the hex code before executing in program
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 21
EXPERIMENT No.2b
AIM: Write a program to subtraction of two 8-bit BCD numbers.
APPARATUS REQUIRED:
S. No.
Name of Specification/ Range/ Quantity
Equipment/Compnents/Software Rating
1. 8085 Microprocessor SCIENTECH-8085 01
programming kit, instruction
coding sheet.
2. Power supply A.C (230V Mains)
ALGORITHM:-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
Get the 1st no.
Get the 2 nd no.
Sub two no.
Adjust the decimal
Store the result
end
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 22
PROGRAM:
Memory Label Mnemonics Remarks
location
2000 LXI H, 200A point 1st no.
2003 MOV A, M Load the acc.
2004 INX H Advance Pointer
2005 SUB M Subtract 2nd no.
2006 DAA Decimal adjust
2007 INX H Advance Pointer
2008 MOV M, A Store Result
RST 5
RESULTS:- Input at 3000= 5C
Input at 3001= 10
onput at 3002= 52
CONCLUSION:-
Subtraction of two 8 bit BCD no is done successfully.
PRECAUTION:-
1.verify the hex code before executing in program
Viva Questions:
Q.1.Write a small program to enter animmediate data to accumulator and move it to all registers.
Q2. Why DAA instruction is to be written just after ADD&SUB instruction.
Q3.In above program why MOV A,M instruction is used if direct instruction LDA, address is
available.
Q4.What are the contents of all flags after execution of program for addition.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 23
EXPERIMENT No. 3a
AIM: Write a program to perform multiplication of two 8 bit numbers using bit addition method.
APPARATUS REQUIRED:
S. No. Name of Equipment Specification/ Range/ Quantity
Rating
1. 8085 Microprocessor SCIENTECH-8085 01
programming kit, instruction
coding sheet.
2. Power supply A.C (230V Mains)
ALGORITHM:-
*Assume number to be multiplied is stored at location 2150H and 2151H and result is at
location 2152 AND 2153.
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.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 24
FLOWCHART:
Start
Initialize register A & D
reg. to zero
Get 1st no.
Get 2nd no.
Add 1st no. to content of A reg.
Is carry
Increment D register
Decrement 2nd no.
Is zero
Store the result
END
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 25
PROGRAM:
MVI D, 00 ; Initialize register D to 00
MVI A, 00 ; Initialize Accumulator content to 00
LXI H, 2150 ; HL Points 2150
MOV B, M ; Get the first number in B - register
INX H ; HL Points 2151
MOV C, M ; Get the second number in C- reg.
LOOP : ADD B ; Add content of A - reg to register B.
JNC NEXT ; Jump on no carry to NEXT.
INR D ; Increment content of register D
NEXT : DCR C ; Decrement content of register
JNZ : LOOP ; Jump on no zero to address
STA 2152 ; Store the result in Memory
MOV A, D ; Get the carry in Accumulator
STA 2153 ; Store the MSB of result in Memory
RST 5 ; Terminate the program.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 26
RESULTS: Input at 3000= 05H
Input at 3001= 03H
output at 3002= 0FH
output at 3003= 00H (carry)
CONCLUSION:-
Multiplication of two 8 bit hexadecimal no is done successfully.
PRECAUTION:-
1.verify the hex code before executing in program
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 27
EXPERIMENT No. 3b
AIM: Write a program to perform division of two 8 bit numbers using Repeated Subtraction
method. `
APPARATUS REQUIRED:
S. No. Name of Specification/ Range/ Quantity
Equipment/Software/ Rating
Equipment
1. 8085 Microprocessor SCIENTECH-8085 01
programming kit, instruction
coding sheet.
2. Power supply A.C (230V Mains)
ALGORITHM:-
Assume number to be multiplied is stored at location 2150H and 2151H and result is at
location 2152 AND 2153.
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.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 28
PROGRAM:
LXI H, 2150
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 2152 ; Store the remainder in Memory
MOV A, C ;
STA 2153 ; Store the quotient in memory
HLT ; Terminate the program.
RESULTS: Input at 3000= 09H
Input at 3001= 02H
output at 3002= 01H (remainder)
output at 3003= 04H (quotient)
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 29
CONCLUSION:-
Division of two 8 bit hexadecimal no is done successfully.
PRECAUTION:-
1.verify the hex code before executing in program
Viva Questions:
Q.1 The contents of register (B) and accumulator (A) of 8085 microprocessor are 49H & 39H
respectively. What are the contents of A and the status of carry flag (CY) and sign flag (S) after
exceeding SUB B instructions.
Q.2 Why did you use HLT at the end of the program?
Q.3 What is difference between call and jump.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 30
EXPERIMENT No. 4a
AIM: Write a program to find the largest number in an array of data
APPARATUS REQUIRED:
S. No. Name of Specification/ Range/ Quantity
Equipment/Software/ Rating
Equipment
1. 8085 Microprocessor SCIENTECH-8085 01
programming kit, instruction
coding sheet.
2. Power supply A.C (230V Mains)
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.
1) Load the address of the first element of the array in HL pair.
2) Copy the count to register B.
3) Increment the pointer.
4) Get the first data in accumulator.
5) Decrement the count.
6) Increment the pointer.
7) Compare the content of memory addressed by HL pair with that of Accumulator.
8) If Carry = 0, go to step 10 or if Carry = 1 go to step 9.
9) Copy the content of the memory addressed by HL to Accumulator.
10) Decrement the count.
11) Check for Zero of the count. If Zero Flag (ZF) = 0, go to step 6, or if ZF = 1 go to next
step.
12) Store the largest data in memory.
13) Terminate the program.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 31
Flow Chart:
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 32
PROGRAM:
Memory location Level Mnemonics Remarks
2000 LXI H, 9200H
2003 MVI C, 0F
2005 MVI A, 00
2007 UPP1 MVI B, M
2008 CMP B
2009 JNC BELOW
200C MOV A, B
200D BELOW INX H
200E DCR C
JNZ: UPP1
STA 9210
HLT
RESULTS: Input at 3000= 05 H
Input at 3001= 0A H
Input at 3002= 1F H
Input at 3003= 26 H
Input at 3004= FE H
Input at 3005= F1 H
output at 3100= FE H
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 33
CONCLUSION:-
Largest number is found in an array of data .
PRECAUTION:-
1.verify the hex code before executing in program
2.Take memory locations according model of kit.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 34
EXPERIMENT No. 4b
AIM: Write a program to find the Smallest number in an array of data
APPARATUS REQUIRED:
S. No. Name of Specification/ Range/ Quantity
Equipment/Software/ Rating
Equipment
1. 8085 Microprocessor SCIENTECH-8085 01
programming kit, instruction
coding sheet.
2. Power supply A.C (230V Mains)
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.
) Load the address of the first element of the array in HL pair.
2) Copy the count to register B.
3) Increment the pointer.
4) Get the first data in accumulator.
5) Decrement the count.
6) Increment the pointer.
7) Compare the content of memory addressed by HL pair with that of Accumulator.
8) If Carry = 0, go to step 10 or if Carry = 1 go to step 9.
9) Copy the content of the memory addressed by HL to Accumulator.
10) Decrement the count.
11) Check for Zero of the count. If Zero Flag (ZF) = 0, go to step 6, or if ZF = 1 go to next
step.
12) Store the largest data in memory.
13) Terminate the program.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 35
Flow Chart
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 36
PROGRAM:
Memory location Level Mnemonics Remarks
2000 LXI H, 9200H
2003 MVI C, 0F
2005 MVI A, 00
2007 UPP1 MVI B, M
2008 CMP B
2009 JNC BELOW
200C MOV A, B
200D BELOW INX H
200E DCR C
JNZ: UPP1
STA 9210
HLT
RESULTS: Input at 3000= 05 H
Input at 3001= 00 H
Input at 3002= 1F H
Input at 3003= 26 H
Input at 3004= FE H
Input at 3005= F1 H
output at 3100= 00H
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 37
CONCLUSION:-
Smallest number is found in an array of data .
PRECAUTION:-
1.verify the hex code before executing in program
2.Take memory locations according model of kit.
Viva Questions:-
1. The following instructions have been executed by an 8085 microprocessor.
ADDRESS (HEX) Instruction
6010H LXI H, 8A79H
6013H MOVA, L
6015H ADDH
2. Suppose HL=ABCD, stack painter = 1234, what happens after SPHL is executed.
3. Write a segment of program to exchange of BC register pair with DE register pair
without using MOV instructions.
MICROPROCESSORS & MICROCONTROLLER LAB (KEC-552), ECE Dept., Page 38