Ee6612 Microprocessor and Microcontroller Laboratory
Ee6612 Microprocessor and Microcontroller Laboratory
w.E
asy
En
gi nee
rin
g .ne
t
LAB MANUAL
ww
Regulation
w.E : 2013
Branch : B.E. - EEE
asy
Year & Semester
En
: III Year / VI Semester
gin
EE6612-MICROPROCESSOR AND MICROCONTROLLER LAB eer
ing
.ne
t
ICAL ENG
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 2
OBJECTIVES:
w.E
LIST OF EXPERIMENTS:
asy
1. Simple arithmetic operations: addition / subtraction / multiplication / division.
2. Programming with control instructions:
En
(i) Ascending / Descending order, Maximum / Minimum of numbers
(ii) Programs using Rotate instructions
(iii)Hex / ASCII / BCD code conversions. gin
3. Interface Experiments: with 8085
(i) A/D Interfacing. & D/A Interfacing. eer
4. Traffic light controller.
5. I/O Port / Serial communication ing
6. Programming Practices with Simulators/Emulators/open source
7. Read a key, interface display .ne
8. Demonstration of basic instructions with 8051 Micro controller execution, including:
(i) Conditional jumps, looping
(ii) Calling subroutines.
t
9. Programming I/O Port 8051
(i) study on interface with A/D & D/A
(ii) study on interface with DC & AC motor .
10. Mini project development with processors.
TOTAL: 45 PERIODS
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 3
INDEX
4
w.E PROGRAM FOR 8 BIT DIVISION USING
8085
5 asy
PROGRAM TO FIND THE LARGEST
NUMBER IN GIVEN ARRAY USING 8085
6 En
PROGRAM TO FIND THE SMALLEST
gin
NUMBER IN GIVEN ARRAY USING 8085
7
PROGRAM FOR SORT ASCENDING ORDER
USING 8085
eer
8
PROGRAM FOR SORT DESCENDING
ing
.ne
ORDER USING 8085
9
PROGRAM FOR CODE CONVERSION OF
HEX TO DECIMAL
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 4
18 8051
asy
PROGRAM FOR 8 BIT ADDITION USING
19 USING 8051 En
PROGRAM FOR 8 BIT SUBTRACTION
gin
PROGRAM FOR 8 BIT MULTIPLICATION
20 USING 8051
eer
21
PROGRAM FOR 8 BIT DIVISION USING
8051
ing
22
PROGRAM FOR INTERFACING OF ADC
WITH 8051 .ne
23
PROGRAM FOR INTERFACING OF DAC
WITH 8051
t
PROGRAM FOR INTERFACING OF
24 STEPPER MOTOR WITH 8051
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 5
Ex No : 1
Date :
PROGRAM FOR 8 BIT ADDITION USING 8085
AIM:
To write an assembly language program for addition of two 8 bit data using 8085
microprocessor.
APPARATUS REQUIRED:
ALGORITHM:
3
w.E
Keyboard Connector 1
asy
1. Clear the register C
En
2. Initialize the memory pointer to data location.
gin
3. Get the first Data from memory Location and move to register A.
eer
4. Get the second data from memory location.
5. Add first and second data.
6. If carry the increment the register C by one.
ing
7. Store the result to memory location.
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 6
START
Initialize Memory Location and get the first data from memory
w.E
ge
asy
Add the first and Second data’s
ge En If
NO
carry=1?
gin
Yes
eer
Increment “C” register by One ing
.ne
ge Store the Result to Memory Location
STOP
t
ge
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 7
PROGRAM:
ww ADD M
JNC LOOP1
Add First and Second Data
Jump if No Carry to loop1
w.E Loop1
INR C
STA 9500
Increment the “C” register by one
Store the Result
asy
MOV A,C
Move the Carry result to Register
“A”
STA 9501
HLT En Store the Carry Result
Stop the program
gin
Input: eer
Memory location Data ing
9200
.ne
Output:
9201
t
Memory location Data
9500
9501
Result :
Thus the addition of two 8 bit data’s was executed using the 8085 microprocessor.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 8
Ex No : 2
Date :
PROGRAM FOR 8 BIT SUBTRACTION USING 8085
AIM:
To write an assembly language program for subtraction of two 8 bit data using 8085
microprocessor.
APPARATUS REQUIRED:
ww 1
2
8085 Microprocessor kit
+5Volts Power Supply
1
1
ALGORITHM:
w.E
3 Keyboard Connector 1
asy
1. Clear the register “C”
En
2. Initialize the memory pointer to data location.
gin
3. Get the first Data from memory Location and move to register “A”.
4. Get the second data from memory location.
5. Subtract the first and second data.
eer
6. If occur carry the increment the register ‘c’ by one.
7. Store the result to memory location. ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 9
START
ww
w.E
Initialize Memory Location and get the first data from memory
ge asy
Get the Second data from memory Location
En
ge
gin
Subtract the first and Second data’s
eer
ge If
carry=1?
YES
ing
NO .ne
Increment “C” register by One t
ge Store the Result to Memory Location
STOP
ge
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 10
PROGRAM:
w.E INR C
CMA
Increment the “C” register by
one
Complement the Accumulator
asy
ADI 01 Add by one for two’s
complement
Loop1 STA 9500
En Store the Result
MOV A,C
gin Move the Carry result to
Register “A”
STA 9501
HLT eer Store the Carry Result
Stop the program
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 11
Input:
Output:
ww 9501
w.E
asy
En
gin
eer
ing
.ne
t
RESULT :
Thus the subtraction of two numbers was performed using the 8085 microprocessor.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 12
Exp No : 3
Date :
APPARATUS REQUIRED:
ww 2
3
+5Volts Power Supply
Keyboard Connector
1
1
ALGORITHM: w.E
1. Clear the register “A”
asy
En
2. Initialize the memory pointer to data location.
3. Get the first Data from memory Location and move to register “C”.
4. Get the second data from memory location.
gin
eer
5. Add the Memory Data and A Register.
6. Decrement the register ‘c’ by one
7. Check the register “C’ is Zero otherwise repeat step 5.
8. Store the result to memory location. ing
PROGRAM :
.ne
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
t
8000 MVI A,00 Clear the “A” Register
LXI H,9200 Initialize the memory pointer
MOV C,M Move the First Data to C Reg
INX H Increment the memory pointer
Loop1 ADD M Add First and Second Data
DCR C Decrement C register by one
JNZ LOOP1 Jump if No Zero to loop1
STA 9500 Store the Result
HLT Stop the program
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 13
START
Initialize Memory Location and get the first data from memory
ww
w.E
AddgeRegister “A” and memory Register then decrement register “c” by 1
ge asy If C=0? NO
En
Yes
gin
Store the Result to Memory Location
eer
STOP
ing
ge
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 14
Input:
Output:
ww
w.E
asy
En
gin
eer
ing
.ne
t
RESULT:
Thus the multiplication of two numbers was performed using the 8085 microprocessor.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 15
Exp No : 4
Date :
To write an assembly language program for division of two 8 bit data using 8085 microprocessor.
APPARATUS REQUIRED:
ww2
3
+5Volts Power Supply
Keyboard Connector
1
1
ALGORITHM: w.E
asy
1. Clear the Register “C”.
2. Initialize the Memory Pointer.
En
3. Get the First Data from memory to Accumulator ( Dividend)
gin
4. Get the Second Data from memory (Divisor)
5. Compare Register “A” and “M”
eer
6. If No carry, Subtract Divisor from Dividend [(A)-(M)]
7. Increment Register “C” by one.
8. Compare Register “A” and “M” ing
9. If No Carry go to step 6
.ne
10. Store the result to memory location.
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 16
asy No
Subtract register M from register A
En
gin
Compare register A and M register
No
If Cy=1? eer
ing
Yes
Store the result to Memory Location .ne
STOP
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 17
PROGRAM:
ww Loop2
JC Loop1
SUB M
If carry jump to loop1
Subtract register A and M Data
w.E INR C
CMP M
Increment C register by one
Compare register A and M
asy
JNC Loop2
data’s
Jump if No Carry to loop2
STA 9500
En Store the Quotient Result
MOV A,C
STA 9501 gin Move register C to A
Store the Remainder Result
HLT
eer Stop the program
Loop1 MVI A,00
STA 9500 ing
Clear the accumulator
Store the result
STA 9501 Store the result
stop .ne
t
HLT
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 18
Input:
9200
9201
Output:
w.E 9500
9501
asy
En
gin
eer
ing
.ne
t
RESULT :
Thus the division of two numbers was performed using the 8085 microprocessor.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 19
Exp No : 5
Date :
AIM:
To write an assembly language program to find the largest number in a given array using
8085 microprocessor.
APPARATUS REQUIRED:
3
w.E +5Volts Power Supply
Keyboard Connector
1
asy
ALGORITHM:
En
1. Initialize the Memory Pointer.
2. Load the number of array to B register. gin
3. Move the first data to register A.
eer
4. Increment the Memory pointer.
5. Compare the register A and M . ing
6. If No carry jump to loop2. .ne
7. Move the register M to A.
8. Decrement the register B by one.
t
9. Check register B is Zero otherwise go to step 4.
10. Store the Largest value to memory location.
11. Stop.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 20
START
ww
w.E Increment the memory location
asy
En
If cy=0? Yes
gin
eer
No
No
Move the memory data to register A
ing
Check Reg B=0? .ne
Yes
t
Move the result to memory location
STOP
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 21
PROGRAM:
ADDRES OPCOD
LABEL MNEMONICS COMMENTS
S E
asy
JNC Loop2 If No carry jump to loop2
MOV A, M
En Move register M to A
LOOP2 DCR B
CMP M gin Decrement B register by one
Compare register A and M
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 22
Input:
ww Output:
w.E
asy
En
Memory location Data
9500
gin
eer
ing
.ne
t
RESULT:
Thus the program to find the largest number in a given array using 8085 microprocessor
was executed.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 23
Exp No : 6
Date :
AIM:
To write an assembly language program to find the smallest number in a given array
using 8085 microprocessor.
APPARATUS REQUIRED:
ww 1
2
8085 Microprocessor kit
+5Volts Power Supply
1
1
3 w.E Keyboard Connector 1
asy
ALGORITHM:
En
1. Initialize the Memory Pointer.
gin
2. Load the number of array to B register.
3. Move the first data to register A.
eer
4. Increment the Memory pointer.
5. Compare the register A and M . ing
6. If carry jump to loop2.
.ne
7. Move the register M to A.
8. Decrement the register B by one.
9. Check register B is Zero otherwise go to step 4.
t
10. Store the Largest value to memory location.
11. Stop.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 24
START
w.E Yes
asy If cy=0?
En No
gin
Move the memory data to register A
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 25
PROGRAM:
ww Move register M to A
MOV A, M
Loop2 DCR B Decrement B register by one
CMP M Compare register A and M
asy
STA 9500
HLT
Store the Result to memory
Stop
Input: En Output:
ing
9101
9500
9102
9103
.ne
t
RESULT:
Thus the program to find the smallest number in a given array using 8085 microprocessor
was executed.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 26
Exp No : 7
Date :
AIM:
To write an assembly language program to sort ascending order in a given array using
8085 microprocessor.
APPARATUS REQUIRED:
ALGORITHM: asy
En
1. Initialize the Memory Pointer.
gin
2. Load the number of array to B register.
3. Move the first data to register A.
4. Increment the Memory pointer. eer
5. Compare the register A and M . ing
6. If carry jump to loop2.
.ne
7. Move the register M to A.
8. Decrement the register B by one.
9. Check register B is Zero otherwise go to step 4.
t
10. Store the Largest value to memory location.
11. Stop.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 27
START
Initialize counter1=09
ww
w.E
No
Is (pointer-1)>(pointer)?
asy
Interchange the content
Yes
En
gin
Decrement counter2 and Increment memory pointer
No No
Is counter2=0?
eer
Yes
ing
Decrement counter 1
.ne
Is counter1=0?
Yes
t
STOP
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 28
PROGRAM:
w.E JC L1
MOV D, M
MOV M,A
If carry jump to loop1
Move register M to D
Move register M to A
asyDCX H
MOV M,D
Decrement memory pointer
Move register M to D
INX H
En Increment memory pointer
L1 DCR C
JNZ L2
gin Decrement B register by one
Jump if No Zero to loop2
DCR B
JNZ L3 eer Decrement B register by one
Jump if No Zero to loop3
HLT Stop
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 29
Input:
ww 9108
9109
w.E
Output: asy
En
Memory location
9100
Data
gin
9101
9102 eer
9103
9104 ing
9105
.ne
9106
9107
9108
t
9109
RESULT:
Thus the program of sort the ascending order in given array was executed by
using 8085.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 30
Exp No : 8
Date :
AIM:
To write an assembly language program to sort descending order in a given array using
8085 microprocessor.
APPARATUS REQUIRED:
asy
En
ALGORITHM:
gin
2. Load the number of array to B register.
3. Move the first data to register A.
eer
4. Increment the Memory pointer.
5. Compare the register A and M . ing
6. If no carry jump to loop2.
.ne
7. Move the register M to A.
8. Decrement the register B by one.
9. Check register B is Zero otherwise go to step 4.
t
10. Store the Largest value to memory location.
11. Stop.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 31
START
Initialize counter1=09
ww
w.E
No
Increment the memory pointer
asy
Is (pointer-1)>(pointer)?
Yes
En
Interchange the content gin
No
Yes
t
Is counter1=0?
STOP
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 32
PROGRAM:
ww JNC L1
datas
If carry jump to loop1
w.E MOV D, M
MOV M,A
Move register M to D
Move register M to A
asy
DCX H
MOV M,D
Decrement memory pointer
Move register M to D
INX H
En Increment memory pointer
L1 DCR C
JNZ L2 gin Decrement B register by one
Jump if No Zero to loop2
DCR B
eerDecrement B register by one
ing
JNZ L3 Jump if No Zero to loop3
HLT Stop
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 33
Input:
ww
9108
9109
Output: w.E
asy
Memory location
En
Data
9100
9101 gin
9102
9103 eer
9104
9105 ing
9106
9107 .ne
9108
9109 t
RESULT:
Thus the program of sort the descending order in given array was executed by using
8085.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 34
EX.NO:9
Date :
APPARATUS REQUIRED:
ww Sl.No
1
Name of the Apparatus
8085 Microprocessor kit
Qty
1
2
3 w.E
+5Volts Power Supply
Keyboard Connector
1
1
asy
ALGORITHM:
En
1. Initialize the Memory Pointer.
2. Increment B register. gin
eer
3. Increment accumulator by one and adjust to decimal every time.
4. Compare the given decimal number with accumulator value.
ing
5. When both matches, the equivalent hexadecimal value is in B register.
6. Store the resultant in memory location.
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 35
START
w.E No Is A=M?
asy Yes
En
Store the result to memory Yes
gin
STOP
eer
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 36
PROGRAM:
w.E
MOV A,B Move register B to A
STA 9500 Store the result to memory
HLT Stop the program
asy
Input:
En
Memory location Data
gin
9100
eer
Output: ing
.ne
Memory location
9500
Data
t
RESULT:
Thus the program of conversion of decimal to hex given data was executed by using
8085.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 37
Exp No:10
Date :
AIM:
To write an assembly language program to convert a given hexadecimal number into
decimal number using 8085 microprocessor.
APPARATUS REQUIRED:
3
w.E
+5Volts Power Supply
Keyboard Connector
1
asy
ALGORITHM:
En
1. Initialize the Memory Pointer.
2. Increment B register. gin
eer
3. Increment accumulator by one and adjust to decimal every time.
4. Compare the given decimal number with B register value.
ing
5. When both match, the equivalent decimal value is in A register.
6. Store the resultant in memory location. .ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 38
START
w.E Is Cy=1?
asy No
Yes
En
Increment the register C by one
gin
Transfer A to D and B to A
eer
Is A=M?
ing
No
.ne
Store the Result
Yes
t
STOP
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 39
PROGRAM:
ww NEXT
INR
MOV
MOV
C
D,A
A,B
Increment register C by one
Transfer A to D
Transfer B to A
w.E CMP
MOV
M
A,D
Compare A and M register
Transfer D to A
asy
JNZ
STA
Loop1
9500
Jump if No Zero to loop1
Store the result to memory
MOV
STA
A,C
En
9501
Move register B to A
Store the result to memory
HLT
gin Stop the program
Input:
Memory location Data eer
9100
ing
Output:
.ne
Memory location
9500
Data
t
RESULT:
Thus the program of conversion of hexadecimal to decimal given data was executed by
using 8085.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 40
EX.NO:11
DATE :
APPARATUS REQUIRED:
wwSl.No
1
Name of the Apparatus
8085 Microprocessor kit
Qty
1
2
3 w.E +5Volts Power Supply
Keyboard Connector
1
1
asy
ALGORITHM:
En
1. Start the program
2. Load the data from address 9100 to A gin
3. Compare register A and data 0Ah(decimal 10).
eer
4. If no carry add 37h with register A.
5. If Carry add 30h with register A. ing
6. Store the result to memory location.
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 41
START
ww No
Is Cy=1?
w.E
Add register A with 07
asy Yes
En
gin
Add register A with 30
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 42
PROGRAM:
asy
Input:
En
Memory location Data
gin
9100
eer
Output: ing
.ne
Memory location
9500
Data
t
RESULT:
Thus the program of conversion of binary to ASCII given data was executed by using
8085.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 43
Exp No : 12
DATE :
APPARATUS REQUIRED:
asy
ALGORITHM:
En
1. Start the program
2. Load the data from address 9100 to A gin
3. Compare register A and data 3Ah.
eer
4. If no carry subtract 37h with register A.
5. If carry subtract 30h with register A. ing
6. Store the result to memory location.
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 44
START
w.E Yes
Is Cy=1?
Yes
asy
Subtract register A with 07
En No
gin
Subtract register A with 30
eer
Store the result ing
.ne
STOP
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 45
PROGRAM:
ww LOOP1
ADI 07H
ADI 30H
Add A with 07
Add A with 30
asy
Input :
En
Memory location Data
gin
9100
eer
Output: ing
Memory location Data .ne
9500 t
RESULT:
Thus the program of conversion of ASCII to binary given data was executed by using
8085.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 46
EX.NO:13
DATE :
AIM:
To write an assembly language program to convert an analog signal into a digital signal
using an ADC interfacing with 8085 microprocessor.
APPARATUS REQUIRED:
ww 1
2
8085 Microprocessor kit
+5Volts Power Supply
1
1
3
4
w.EKeyboard Connector
ADC Interfacing kit
1
1
5 Multimeter
asy 1
eer
Connect the 26-pin connector from the kit to adc chord.
ing
Connect the card from keyboard into the socket provided in the kit.
Switch on the power supply.
Assemble your program.
.ne
Vary the pot in the adc chord.
t
Execute it and view the output count in the register A which will be displayed in
LCD display.
Repeat the above steps for different inputs in the pots.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 47
8085 ADDRESS:
ww
w.E
asy
En
gin
eer
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 48
PROGRAM:
ww OUT 22
MVI A,FF
OUT 22
.ne
Analog Input Digital output
t
RESULT :
Thus the conversion of a analog signal into and digital signal was executed using
interfacing of ADC with 8085.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 49
EX.NO:14
DATE :
AIM:
To write an assembly language program to convert a digital signal into a analog signal
using an DAC interfacing with 8085 microprocessor.
APPARATUS REQUIRED:
eer
Connect the card from keyboard into the socket provided in the kit.
Switch on the power supply.
ing
Assemble your program.Give the digital data in the software program itself.
.ne
Execute it and view the output count in the register A which will be displayed in
CRO
Repeat the above steps for different digital inputs. t
i)SQUARE WAVE FORM
ALGORITHM:
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 50
8085 ADDRESS:
ww
w.E
asy
En
gin
eer
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 51
ww OUT 21
CALL 9100
output in port B
Delay subroutine
w.E JMP
LOOP1(9004)
Jump To Start
9100 delay
asy Delay Count
MVI C,FF
Loop1 MVI B,FF Load data FF to register A
Loop2 NOP
NOP
En No operation
No operation
DCR B
JNZ loop2 gin Decrement register B
If no zero jump to loop2
DCR C
JNZ loop1 eer Decrement register C by one
If no zero jump to loop1
RET
ing
Return to main Program
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 52
ww time
w.E
asy
En
gin
eer
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 53
ALGORITHM:
1. Load the initial value (00) to Accumulator
2. Move the accumulator content to DAC.
3. Increment the accumulator content by 1.
4. Repeat steps 3 and 4.
ww
5. Output digital data from 00 to FF constant steps of 01 to DAC1 repeat this sequence
again and again. As a result a saw – tooth wave will be generated at DAC1 output.
w.E
PROGRAM: SAW TOOTH WAVE FORM
asy
En
ADDRESS LABEL MNEMONICS
ginOPCODE COMMENTS
.ne
START MVI A,00 Low Input
LOOP1 OUT 21 output in port B
INR A
JNZ LOOP1
t
Increment register A by one
If zero jump to loop1
JMP START Jump To Start
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 54
ww
w.E
SAW TOOTH WAVE FORM :
V asy
En
gin time
eer
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 55
w.E
PROGRAM: TRIANGULAR WAVE FORM
9000 START En
MVI L,00 Transfer 00 to register L
LOOP1 MOV A,L
gin Transfer L to A
OUT 21
INR L
eer Output in control register
Increment register L
JNZ LOOP1
MVI L,FF ing
If no zero jump to loop1
Transfer FF to register L
LOOP2 MOVA,L
OUT 21
Transfer L to A
.ne
Output in control register
DCR L
JNZ LOOP2
JMP START
Decrement register L
t
If no zero jump to loop2
Jump to start loop
TRIANGULAR WAVE FORM :
time
RESULT :
Thus the conversion of a digital signal into an analog signal was executed using
interfacing of DAC with 8085.
VVIT - DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 56
EXP.No :15
DATE :
APPARATUS REQUIRED:
9000
9002
MVI
MVI
C,BA
A,12 control word .ne
7 segment code for 2
9004
9006
9008
OUT
MVI
OUT
71
A,3E
71
Control port
Frequency division
Control register
t
900A MVI A,A0 Display / write inhibit
900C OUT 71 Control register
900E MVI B,08
9010 MVI A,00 Clear display
9012 OUT 70
9014 DCR B
9015 JNZ 9012
9018 MOV A,C Take the character to display
9019 OUT 70
901B JMP 9019
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 57
f g b
e c
w.E
asy
En
gin
eer
ing
.ne
t
RESULT:
Thus 8279 controller was interfaced with 8085 and program for rolling display was
executed successfully.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 58
EXP.No: 16
DATE :
ww
APPARATUS REQUIRED:
Sl.No
1 w.E Name of the Apparatus
8085 Microprocessor kit
Qty
1
2
3 asy
+5Volts Power Supply
Keyboard Connector
1
1
4
En
Traffic Light control Interfacing kit 1
8085 ADDRESS:
t
PORT ADDRESS
CWR 23
PORT A 20
PORT B 21
PORT C 22
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 59
ww 8508
850A
850C
MVI A,4D
OUT 20
CALL
For green LEDs in N-S
Direction
Sequence Delay
asy
AMBER(855F)
For stopping vehicles in N-S direction & starting E-W direction
8512 MVI A,8B For stopping N-S sides
8514
8516
OUT 20
En
CALL DELAY
For starting E-W sides
Sequence Delay
8519 CALL AMBER
gin Amber delay
For starting right turn in N-S sides & stopping E-W sides
851C
851E
MVI A,49
OUT 20 eer For free left in all sides
For stopping E-W sides
8520
8522
MVI A,01
OUT 22 ing
For right turn in N-S sides
8524
8527
CALL DELAY
MVI A,07 .ne
8529
852B
OUT 22
CALL AMBER
Stopping Right Turn In N-S Sides & Starting Turn In E-W Sides
t
852E MVI A,89
8530 OUT 20
8532 MVI A,02
8534 OUT 22
8536 CALL DELAY
8539 MVI A,00
853B OUT 22
853D MVI A,30
853F OUT 20
8541 MVI C,04
8543 CALL DELAY
For starting Pedestrian
VVIT - DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 60
ww 855F
8561
AMBER MVI A,39
OUT 20
8563
8568
w.E MVI C,08
CALL DELAYSUB
8568
asyRET
8569 DELAY MVI C,40
En
856B
856E
CALL DELAYSUB
RET gin
856F DELAYSUB
eer
BACK2
BACK1
MVI D,FF
MVI A,FF ing
BACK NOP
.ne
DCR A
JNZ BACK t
DCR D
JNZ BACK1
MOV A,C
JZ OUT
DCR C
JNZ BACK2
OUT RET
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 61
ww
w.E
asy
En
gin
eer
ing
.ne
t
RESULT:
Thus an assembly language program to simulate the traffic light at an intersection
using a traffic light was written and implemented.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 62
EXP.No : 17
DATE:
APPARATUS REQUIRED:
ww 1
2
8085 Microprocessor kit
+5Volts Power Supply
1
1
3
4
w.E
Keyboard Connector
8251/8253 Interfacing kit
1
1
asy
ALGORITHM:
En
1. Initialize timer (8253) IC
2. Move the Mode command word (36H) to A reg.gin
3. Output it port address CE
eer
4. Move the command instruction word (37H) to A reg.
5. Output it to port address C8 ing
PROGRAM: SQUARE WAVE GENERATION
.ne
ADDRESS LABEL MNEMONICS OPCODE COMMENTS t
9000 MVI A,36 Channel 0 in mode 3
OUT CE Send mode control word
MVI A,0A LSB of count
OUT C8 Write count to register
MVI A,00 MSB of count
OUT C8 Write count to register
HLT Stop the program
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 63
time
ww
w.E
asy
En
gin
eer
ing
.ne
t
RESULT:
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 64
Exp No : 18
Date :
AIM:
To write an assembly language program for addition of two 8 bit data using 8051
microcontroller.
APPARATUS REQUIRED:
ALGORITHM:
3
w.E
Keyboard Connector 1
asy
1. Clear the register “C”
En
2. Initialize the memory pointer to data location.
gin
3. Get the first Data from memory Location and move to register “A”.
4. Get the second data from memory location.
5. Add first and second data.
eer
6. If carry the increment the register ‘C’ by one.
7. Store the result to memory location. ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 65
START
ww Initialize Memory Location and get the first data from memory
w.E
ge Get the Second data from memory
asy
ge
En
Add the first and Second data’s
gin
ge If
carry=1? eer
NO
ing
Yes
ge STOP
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 66
PROGRAM:
OP
ADDRESS LABEL MNEMONICS COMMENTS
CODE
8000 CLR C Clear the “Carry” Flag
MOV R0,#00
MOV DPTR,#9200 Initialize the memory pointer
MOVX A,@DPTR Move the First Data to A Reg
MOV B,A Transfer Data To B
ww INC DPTR
MOVX A,@DPTR
Increment the memory pointer
Get the second data from
Input:
.ne
Memory location
9200
9201
Data
t
Output:
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 67
Exp No : 19
Date :
AIM:
To write an assembly language program for subtraction of two 8 bit data using 8051
microcontroller.
APPARATUS REQUIRED:
ALGORITHM:
3
w.E
Keyboard Connector 1
asy
1. Initialize the memory pointer to data location.
En
2. Get the first Data from memory and move to register A.
3. Get the second data from memory location.
4. Subtract the first and second data. gin
5. Store the result to memory location.
eer
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 68
START
Initialize Memory Location and get the first data from memory
ww
w.E
ge Subtract the first and Second data’s
ge
asy
En
Store the Result to Memory Location
gin
ge STOP
eer
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 69
PROGRAM:
ww SUBB A,B
MOV DPTR,#9500
memory
Add First and Second Data
Initialize the memory
Input:
HLT
asy SJMP : HLT Stop the program
En
Memory location Data
gin
9200
eer
ing
9201
Output:
.ne
Memory location Data t
9500
RESULT :
Thus the subtraction of two numbers was performed using the 8085 microprocessor.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 70
Exp No : 20
Date :
AIM:
To write an assembly language program for multiplication of two 8 bit data using 8051
microcontroller.
APPARATUS REQUIRED:
w.E
2 +5Volts Power Supply 1
3 Keyboard Connector 1
ALGORITHM:
asy
En
1. Initialize the memory pointer to data location.
gin
2. Get the first Data from memory and move to register A.
3. Get the second data from memory location.
4. Multiply the first and second data.
eer
5. Store the result to memory location.
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 71
START
Initialize Memory Location and get the first data from memory
w.E
ge
asy
Multiply first and second data
ge En
Initialize the output memory location
gin
ge Store the Result to Memory Location
eer
ing
ge STOP
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 72
PROGRAM:
ww MOVX A,@DPTR
pointer
Get the second data from
memory
asy
MOV DPTR,#9500
MOVX @DPTR,A
Initialize the memory pointer
Store The LSB Result
INC DPTR
En Increment the data pointer
MOV B,A
MOVX @DPTR,A gin Transfer B to A
Store the MSB result
HLT SJMP : HLT
eerStop the program
Input: ing
Memory location Data .ne
9200
9201 t
Output:
RESULT:
Thus the multiplication of two numbers was performed using the 8085 microprocessor.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 73
Exp No : 21
Date :
PROGRAM FOR 8 BIT DIVISION USING 8051
AIM:
To write an assembly language program for division of two 8 bit data using 8051
microcontroller.
APPARATUS REQUIRED:
ww
2 +5Volts Power Supply 1
3 Keyboard Connector 1
ALGORITHM:
w.E
asy
1. Initialize the memory pointer to data location.
2. Get the first Data from memory and move to register A.
En
3. Get the second data from memory location.
4. Divide the first and second data.
5. Store the result to memory location. gin
eer
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 74
START
Initialize Memory Location and get the first data from memory
ww
w.E
ge Get the Second data from memory
En
Initialize the output memory location
ge
gin
ge Store the Result to Memory Location eer
ing
ge STOP .ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 75
PROGRAM:
ww MOV DPTR,#9500
MOVX @DPTR,A
Data
Initialize the memory pointer
Store The Remainder Result
HLT asy
MOVX @DPTR,A
SJMP : HLT
Store the Quotient result
Stop the program
Input: En
Memory location Data gin
9200
eer
9201
ing
Output:
.ne
Memory location
9500
Data t
9501
Result:
Thus the division of two numbers was performed using the 8085 microprocessor.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 76
EX.NO:22
DATE :
AIM:
To write an assembly language program to convert an analog signal into a digital signal
using an ADC interfacing with 8051 microcontroller.
APPARATUS REQUIRED:
ww 1
2
8051 Microcontroller kit
+5Volts Power Supply
1
1
w.E
3 Keyboard Connector 1
4 ADC Interfacing kit 1
5 Multi-meter 1
gin
Connect the 26-pin connector from the kit to adc chord.
eer
Connect the card from keyboard into the socket provided in the kit.
Switch on the power supply.
Assemble your program.
ing
Vary the pot in the adc chord.
.ne
Execute it and view the output count in the register A which will be displayed in
LCD display.
Repeat the above steps for different inputs in the pots.
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 77
8085 ADDRESS:
ww
w.E
asy
En
gin
eer
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 78
PROGRAM:
ww MOV DPRT,#6002
MOV A,#00
En
MOV DPTR,#6000
MOV A,#FF
MOVX @DPTR,A
LCALL 00BB gin
DELAY
LOOP
MOV R1,#FF
NOP eer
NOP
DJNZ R1,LOOP ing
RET
.ne
Return to main Program
RESULT:
Thus the conversion of a analog signal into and digital signal was executed using
interfacing of ADC with 8051.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 79
EX.NO:23
DATE :
AIM:
To write an assembly language program to convert an digital signal into a analog signal
using an DAC interfacing with 8051 microcontroller.
APPARATUS REQUIRED:
ww 1
2
8051 Microcontroller kit
+5Volts Power Supply
1
1
3
4
5
w.E
Keyboard Connector
DAC Interfacing kit
CRO
1
1
1
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 80
8085 ADDRESS:
ww
w.E
asy
En
gin
eer
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 81
w.E
asy
V
En
gin
time
eer
ing
.ne
t
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 82
ALGORITHM:
ww
PROGRAM: SAW TOOTH WAVE FORM
w.E
ADDRESS LABEL MNEMONICS OPCODE COMMENTS
En
LCALL DELAY
INC R1
SJMP LOOP gin
DELAY MOV R0,#FF
eer
RPT DJNZ,R0,RPT
ing
RET
.ne
V t
time
RESULT :
Thus the conversion of a digital signal into an analog signal was executed using
interfacing of DAC with 8051.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 83
EX.NO:24
DATE :
THEORY:
A motor in which the rotor is able to assume only discrete stationary angular position is a
stepper motor. The rotary motion occurs in a step-wise manner from one equilibrium position to
ww
the next. Stepper Motors are used very wisely in position control systems like printers, disk
drives, process control machine tools, etc.
w.E
The basic two-phase stepper motor consists of two pairs of stator poles. Each of the four
poles has its own winding. The excitation of any one winding generates a North Pole. A South
asy
Pole gets induced at the diametrically opposite side. The rotor magnetic system has two end
faces. It is a permanent magnet with one face as South Pole and the other as North Pole.
The Stepper Motor windings A1, A2, B1, B2 are cyclically excited with a DC current to
En
run the motor in clockwise direction. By reversing the phase sequence as A1, B2, A2, B1,
anticlockwise stepping can be obtained.
gin
2-PHASE SWITCHING SCHEME:
eer
In this scheme, any two adjacent stator windings are energized. The switching scheme is
shown in the table given below. This scheme produces more torque.
ing
A1 A2 B1 B2 HEX
CLOCK
WISE
.ne
ANTI
CLOCKWISE
1
0
0
1
0
0
1
1
09
05
t
0 1 1 0 06
1 0 1 0 0A
PROCEDURE:
1. Enter the above program starting from location 4100.and execute the same.
2. The stepper motor rotates.
3. Varying the count at R4 and R5 can vary the speed.
4. Entering the data in the look-up TABLE in the reverse order can vary direction of rotation.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 84
PROGRAM:
ww PUSH DPH
PUSH DPL
Transfer DPH to SP
Transfer DPL to SP
D1 asy
MOV R4,#0FF
MOV R5,#0FF
Delay subroutine
D2 DJNZ R5,D2
DJNZ R4,D1 En
POP DPL
gin
eer
POP DPH
INC DPTR Next data
SJMP : START
LOOKUP 09,06,05,0A Data’sing
Stop the program
.ne
t
RESULT:
Thus a stepper motor was interfaced with 8051 and run in forward and reverse directions
at various speeds.
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY 85
ww
w.E
asy
En
gin
eer
ing
.ne
t
Visit : www.EasyEngineering.net