Académique Documents
Professionnel Documents
Culture Documents
LAB MANUAL
.e
ee
ex
cl
u
si
ve
.b
l
og
sp
ot
.c
o
2a
2b
4a
4b
6a
6b
7
8
Finding the smallest and largest number in an array of numbers using 8051
Microcontroller
Interfacing 8 bit DAC Converter with 8051 Microcontroller
Interfacing of Stepper Motor with 8051 Microcontroller
Interfacing Traffic Light Controller using 8051
.c
o
sp
ot
og
.b
l
ve
si
cl
u
ex
ee
.e
w
w
w
10
11
12
Expt.No.
1
EXPT NO 1
AIM:
To write the assembly language programs for performing the following
arithmetic operations:
a) 16 bit binary addition.
b) 16 bit binary subtraction.
c) 16 bit binary multiplication.
.c
o
APPARATUS REQUIRED:
sp
ot
og
PROBLEM STATEMENT:
.b
l
Write an ALP in 8085 P to add and subtract two 16-bit binary numbers stored
ve
in the memory locations 4100 & 4101 and 4102 & 4103 and store the result starting
si
from the memory location 4105H. Also provide an instruction in the above program to
ex
cl
u
observe the carry also and store the carry in the memory location 4104H.
ee
ALGORITHM:
16 BIT ADDITION:
Start.
1.
Enter the two 16 bit data in two register pairs HL and DE.
2.
3.
4.
5.
Store the Carry in the B register and the sum, which is in the register pair HL in
.e
the memory.
6.
Stop.
16 BIT SUBTRACTION:
1.
Start.
2.
3.
Subtract the Low Order Byte of data1 from that of the data 2.
4.
Subtract the How Order Byte of data1 along with borrow from that of the data2.
5.
6.
Stop.
PROBLEM STATEMENT:
Write an ALP in 8085 P to multiply two 16-bit binary numbers stored in the
.c
o
memory locations 4100(LOB) & 4101(HOB) and 4102(LOB) & 4103(HOB) and store
sp
ot
the result in the memory location 4104H & 4105H.Write instructions for performing
16-bit division also.
og
16 BIT MULTIPLICATION.
Start.
2.
3.
4.
5.
6.
If carry flag is set during addition., increment the carry register pair.
7.
8.
Store the contents of the BC register pair which is the carry in memory.
9.
Stop.
.e
ee
ex
cl
u
si
ve
.b
l
1.
16 - BIT DIVISION
1.
Start.
1.
2.
3.
4.
Perform repeated subtraction of divisor from dividend till the dividend is less
than the divisor.
5.
For every subtraction done, keep on incrementing the quotient register pair DE.
6.
7.
8.
Stop.
FLOW CHART
16-BIT ADDITION
16-BIT SUBTRACTION
START
START
INITIALISE
CARRY REGISTER
INTIALIZE BORROW
REGISTER
sp
ot
.c
o
SUBTRACT THE
TWO NUMBERS
.b
l
og
NO
cl
u
YES
YES
INCREMENT
CARRY
REGISTER
STORE THE
RESULT
.e
ee
ex
INCREMENT
CARRY
REGISTER
STORE THE
RESULT
NO
ANY
BORROW?
si
ve
ANY
CARRY
STOP
STOP
16-BIT MULTIPLICATION
16-BIT DIVISION
START
START
PRODUCT=0000
sp
ot
.c
o
DIVIDEND =
DIVIDEND DIVISOR
QUOTIENT =
QUOTIENT + 1
ve
.b
l
og
IS
DIVIDEND <
DIVISOR
cl
u
si
MULTIPLIER =
MULTIPLIER 1
NO
YES
ee
ex
NO
STORE QUOTIENT
.e
IS MULTIPLIER
= 0?
YES
STOP
STORE REGISTER
PAIR
STOP
EXPT NO 2
AIM:
To write an Assembly Language Program (ALP) to sort a given array of
numbers in ascending and descending order.
APPARATUS REQUIRED:
Microprocessor kit, Power supply.
.c
o
PROBLEM STATEMENT:
sp
ot
An array of length 10 is stored from the location starting from 5000H. Sort it
into descending and ascending orders and store the resultant starting from the location
ALGORITHM:
si
ve
.b
l
og
5300H.
cl
u
a. Start.
ex
ee
.e
d. Compare the numbers and swap them if necessary so that the two numbers are in
Stop
d. Compare the numbers and swap them so that the two numbers are in descending
order. And set the Carry Flag FF.
e. Repeat steps c and d till the array is completed.
f. Repeat the steps c, d and e till the Carry Flag FF remains Reset.
g. Stop.
FLOW CHART:
ASCENDING ORDER
DESCENDING ORDER
START
START
.c
o
INITIALIZE POINTER
COUNT = COUNT 1
FLAG = 0
og
sp
ot
INITIALIZE POINTER
COUNT = COUNT 1
FLAG = 0
ve
si
NO
TEMP = POINTER
POINTER = POINTER + 1
POINTER + 1 = TEMP
FLAG=FLAG+1
.e
ee
ex
TEMP = POINTER
POINTER = POINTER + 1
POINTER + 1 = TEMP
FLAG=FLAG+1
cl
u
NO
IS POINTER
POINTER + 1
.b
l
YES
IS POINTER
POINTER + 1
YES
POINTER = POINTER +1
COUNT = COUNT + 1
NO
POINTER = POINTER +1
COUNT = COUNT + 1
NO
IS COUNT
=0
IS COUNT
=0
YES
YES
NO
IS FLAG =
0
IS FLAG =
0
YES
YES
STOP
STOP
EXPT NO 2b
AIM:
To write an Assembly language program for converting a two digit BCD
number (maximum of 99) to hexadecimal and to convert a hexadecimal number
(maximum of FFH) to BCD.
ALGORITHM:
.c
o
2.
Separate the given 8 - bit packed BCD number into two 4 bit
sp
ot
1.
4.
5.
ve
.b
l
og
3.
si
2.
3.
ee
ex
cl
u
1.
.e
4.
The remainder now contains the number of 1s and store it in the next
5.
memory location.
memory location.
7.
Stop.
FLOW CHART:
BCD TO HEX
HEXA TO BCD
START
START
GET DATA CARRY =0
HUNDREDS =0
TENS=0
GET MOST
SIGNIFICANT
DIGIT(MSD)
.c
o
NO
sp
ot
HUNDREDS
=HUNDREDS + 1
MSD =
MSD x 10
IS CARRY
=1 ?
og
.b
l
YES
DATA =DATA +100
si
ve
STORE HEX
DATA
DATA =DATA - 10
TENS = TENS + 1
NO
IS CARRY
=1?
.e
ee
ex
cl
u
START
YES
UNITS =DATA
STORE HUNDREDS ,
TENS , UNITS
STOP
EXPT NO: 4 A
Aim:
To obtain the digital output corresponding to the analog input.
Apparatus Required:
1. Microprocessor 8085 Trainer Kit
.c
o
og
sp
ot
4. Power Supply +5 V
.b
l
Algorithm:
1. Start
ve
2. Initialize control word of 8255 to enable ports A, B as output ports and port C as
3. Initialize accumulator
cl
u
si
output port.
ex
ee
.e
8. Go to step 4
Flowchart
START
INITIALIZE ACCUMULATOR
.c
o
og
sp
ot
ve
.b
l
IS
ACCUMULATOR = 0?
cl
u
si
NO
ex
DECREMENT CONTENTS OF
ACCUMULATOR
.e
ee
STOP
YES
EXPT NO: 4 B
EQUIPMENT REQUIRED
Intel 8085 based MPS 85 2 trainer kit, DAC interface card, 26 pin
flat cable connector, CRO with probe.
ALGORITHM:-
.c
o
sp
ot
og
ve
.b
l
cl
u
si
ex
ee
.e
5. If zero flag is not set then repeat the step 3 onwards, otherwise repeat
FLOW CHART:
Square Waveform:
START
START
SEND 00 TO PORT A
ACC = 00
.c
o
CALL DISPLAY
SUBROUTINE
ACC = ACC + 1
sp
ot
SEND FF TO PORT
A
NO
IF Z
=0
.e
ee
ex
cl
u
si
ve
.b
l
og
CALL DISPLAY
SUBROUTINE
YES
EXPT. NO:5
TRAFFIC LIGHT CONTROLLER USING 8085 MICROPROCESSOR
.c
o
1. Start.
sp
ot
.b
l
og
ve
.e
cl
u
ee
ex
7. Stop.
si
zero.
FLOW CHART
TRAFFIC CONTROLLER
START
Initialize a counter.
Initialize HL pair to 9000h
sp
ot
.c
o
.b
l
og
cl
u
si
ve
ee
ex
.e
COUNTER = 0?
NO
YES
Call Display Program
DISPLAY
sp
ot
.c
o
.b
l
og
si
ve
ex
cl
u
.e
ee
RETURN
EXPT. NO. : 6 A
SQUARE WAVE GENERATION USING 8254
AIM:
To interface 8254 with 8085 microprocessor and generate a square wave
ALGORITHM
1. Start
2. Write control word to initialize 8254 in mode 3
.c
o
sp
ot
5. Stop.
.b
l
og
FLOW CHART
cl
u
si
ve
START
.e
ee
ex
STOP
EXPT. NO. : 6 B
SERIAL DATA TRANSMISSION USING 8251
AIM:
To interface 8251 with 8085 microprocessor and to check the transmission
and reception of a character.
ALGORITHM
.c
o
sp
ot
1. Start
2. Write control word to initialize 8254 in mode 3
og
ve
cl
u
si
6.
.b
l
5. Write mode instruction word and command instruction word for 8251.
.e
ee
ex
9. Stop
START
.c
o
sp
ot
og
ve
.b
l
.e
ee
ex
cl
u
si
STOP
START
sp
ot
.c
o
.e
ee
ex
cl
u
si
ve
.b
l
og
STOP
EXPT. NO. : 7
INTERFACING 8279 WITH 8085 MICROPROCESSOR
AIM:
To interface 8279 with 8085 microprocessor and display the rolling message
HELP US
ALGORITHM
.c
o
5. Start
6. Load the HL pair with the starting address of the message to be displayed
sp
ot
og
.b
l
9. Call delay.
ve
si
.e
ee
ex
cl
u
12. Stop.
FLOW CHART
START
initialize a counter.
.c
o
og
sp
ot
ve
.b
l
ex
cl
u
si
.e
ee
No
Is the
counter
value 0
Yes
EXPT NO 8
AIM:
To write the assembly language programs for performing the following
arithmetic operations:
8 bit binary addition.
b)
c)
d)
a)
.c
o
APPARATUS REQUIRED:
sp
ot
Microcontroller kit.
og
PROBLEM STATEMENT:
.b
l
ve
numbers stored in the memory location 4500H and 4501H and store the result in the
memory location 4600H.Also provide an instruction in the above program to consider
ALGORITHMS:
Start
2.
3.
4.
5.
6.
7.
8.
9.
Move the carry register contents to Accumulator and store the same in
.e
1.
ee
8 BIT ADDITION:
ex
cl
u
si
the carry also and store the carry in the memory location 4601H.
memory.
10.
Stop.
i. e x e
8 BIT SUBTRACTION:
Start
2.
3.
4.
5.
6.
7.
8.
Move the barrow register contents to Accumulator and store the same in
1.
Stop.
sp
ot
9.
.c
o
memory.
8 BIT MULTIPLICATION:
og
Start.
3.
4.
5.
6.
7.
Stop.
ex
cl
u
si
ve
.b
l
2.
ee
1.
2.
Start.
1.
.e
8 BIT DIVISION:
3.
4.
5.
6.
7.
Stop.
FLOWCHART:
8-BIT ADDITION
8-BIT SUBTRACTION
START
START
SET UP COUNTER
(CARRY)
SET UP COUNTER
(CARRY)
GET FIRST
OPERAND TO A
.c
o
GET FIRST
OPERAND TO B
.b
l
og
sp
ot
GET SECOND
OPERAND TO
A
cl
u
YES
NO
COUNTER =
COUNTER + 1
ee
.e
STORE THE
DIFFERENCE
COUNTER =
COUNTER + 1
NO
ANY CARRY?
ex
IS THERE
ANY CARRY
YES
si
ve
A=A+B
SUBTRACT
SECOND
OPERAND
FROM
MEMORY
STOP
STOP
8-BIT MULTIPLICATION
8-BIT DIVISION
START
START
og
sp
ot
.c
o
cl
u
.e
ee
ex
si
ve
.b
l
STOP
STOP
Microcontroller Kit
.c
o
PROBLEM STATEMENT:
sp
ot
An array of length 10 is stored from the location starting from 4600H. Sort it
into descending and ascending orders and store the resultant starting from the location
og
4700H.
ve
.b
l
ALGORITHM:
si
cl
u
1. Start.
ex
.e
ee
4. Compare the numbers and swap them if necessary so that the two numbers are
in descending order.
5. Repeat the steps 3 and 4 till the array is completed.
6. Repeat the steps 3, 4 and5 and store the smallest number..
7. Stop
.c
o
6. Repeat the steps 3, 4 and 5 and store the largest number as the result in
.e
ee
ex
cl
u
si
ve
.b
l
og
Stop.
7.
sp
ot
memory.
FLOW CHART:
FINDING THE MINIMUM AND MAXIMUM NUMBER OF AN ARRAY
START
START
INITIALIZE POINTER
COUNT = COUNT 1
IS POINTER
POINTER + 1
sp
ot
.c
o
YES
IS POINTER
POINTER + 1
YES
INITIALIZE POINTER
COUNT = COUNT 1
NO
TEMP = POINTER
POINTER = POINTER + 1
POINTER + 1 = TEMP
cl
u
ex
POINTER = POINTER +1
COUNT = COUNT + 1
si
ve
.b
l
og
TEMP = POINTER
POINTER = POINTER + 1
POINTER + 1 = TEMP
NO
ee
NO
NO
IS COUNT
=0
YES
YES
.e
IS COUNT
=0
POINTER = POINTER +1
COUNT = COUNT + 1
STORE THE
POINTER RESULT
STORE THE
POINTER RESULT
STOP
STOP
EXPT. NO: 10
INTERFACING DAC CONVERTER USING 8051
AIM:To generate different types of waveforms by interfacing a DAC with a
microcontroller.
EQUIPMENT REQUIRED
Intel 8051 based MPS 85 2 trainer kit, DAC interface card, 26 pin
.c
o
ALGORITHM:-
sp
ot
si
ve
.b
l
og
cl
u
ex
ee
.e
5. If zero flag is not set then repeat the step 3 onwards, otherwise repeat
the step 2 onwards.
FLOW CHART:
Square Waveform:
SEND 00 TO PORT A
ACC = 00
START
sp
ot
.c
o
CALL DISPLAY
SUBROUTINE
ACC = ACC + 1
og
SEND FF TO PORT
A
NO
IF Z
=0
.e
ee
ex
cl
u
si
ve
.b
l
CALL DISPLAY
SUBROUTINE
YES
.b
l
ve
si
cl
u
ex
ee
.e
.c
o
sp
ot
og