TOTAL: 45 PERIODS. Visit : www.EasyEngineering.net. www.EasyEngineering.net. Page 3 of 86. EE6612-MICROPROCESSOR-AND-MIC
ww w.E asy
En gi
nee
rin g
.ne t
**Note: Other Websites/Blogs Owners Please do not Copy (or) Republish this Materials, Students & Graduates if You Find the Same Materials with EasyEngineering.net Watermarks or Logo, Kindly report us to
[email protected]
Visit : www.EasyEngineering.net
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
1
Dharmapuri – 636 703 For more Visit : www.EasyEngineering.net
LAB MANUAL
ww
w.E
Regulation Branch
: 2013 : B.E. - EEE
asy
Year & Semester
En
: III Year / VI Semester
gin
eer
EE6612-MICROPROCESSOR AND MICROCONTROLLER LAB
ing
.ne t
ICAL ENG
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
2
ANNA UNIVERSITY: CHENNAI REGULATION - 2013 SYLLABUS EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY OBJECTIVES:
ww
To provide training on programming of microprocessors and microcontrollers and understand the interface requirements.
w.E
LIST OF EXPERIMENTS:
asy
1. Simple arithmetic operations: addition / subtraction / multiplication / division. 2. Programming with control instructions: (i) Ascending / Descending order, Maximum / Minimum of numbers (ii) Programs using Rotate instructions (iii)Hex / ASCII / BCD code conversions. 3. Interface Experiments: with 8085 (i) A/D Interfacing. & D/A Interfacing. 4. Traffic light controller. 5. I/O Port / Serial communication 6. Programming Practices with Simulators/Emulators/open source 7. Read a key, interface display 8. Demonstration of basic instructions with 8051 Micro controller execution, including: (i) Conditional jumps, looping (ii) Calling subroutines. 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
En
VVIT
-
Visit : www.EasyEngineering.net
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
3
INDEX EX.NO
DATE
NAME OF THE EXPERIMENT
1
PROGRAM FOR 8 BIT ADDITION USING 8085
2
PROGRAM FOR 8 BIT SUBTRACTION USING 8085
ww
PROGRAM FOR 8 BIT MULTIPLICATION USING 8085
5
PROGRAM TO FIND THE LARGEST NUMBER IN GIVEN ARRAY USING 8085
3
w.E
4
PROGRAM FOR 8 BIT DIVISION USING 8085
asy
En
6
PROGRAM TO FIND THE SMALLEST NUMBER IN GIVEN ARRAY USING 8085
7
PROGRAM FOR SORT ASCENDING ORDER USING 8085
8
PROGRAM FOR SORT DESCENDING ORDER USING 8085
9
PROGRAM FOR CODE CONVERSION OF HEX TO DECIMAL
10
PROGRAM FOR CODE CONVERSION OF DECIMAL TO HEX
11
PROGRAM FOR CODE CONVERSION OF BINARY TO ASCII
12
PROGRAM FOR CODE CONVERSION OF ASCII TO BINARY
VVIT
STAFF SIGN REMARKS
-
Visit : www.EasyEngineering.net
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
EX.NO
DATE
NAME OF THE EXPERIMENT
13
PROGRAM FOR INTERFACING OF ADC WITH 8085
14
PROGRAM FOR INTERFACING OF DAC WITH 8085
15
PROGRAM FOR INTERFACING OF SERIAL PORT COMMUNICATION WITH 8085
16
PROGRAM FOR INTERFACING OF KEYBOARD AND DISPLAY WITH 8085
17
PROGRAM FOR INTERFACING OF TRAFFIC LIGHT CONTROLLER WITH 8085
ww
STAFF SIGN REMARKS
w.E
asy
PROGRAM FOR 8 BIT ADDITION USING 8051
18
En
19
PROGRAM FOR 8 BIT SUBTRACTION USING 8051
20
PROGRAM FOR 8 BIT MULTIPLICATION USING 8051
21
PROGRAM FOR 8 BIT DIVISION USING 8051
22
PROGRAM FOR INTERFACING OF ADC WITH 8051
23
PROGRAM FOR INTERFACING OF DAC WITH 8051
24
PROGRAM FOR INTERFACING OF STEPPER MOTOR WITH 8051
VVIT
4
-
Visit : www.EasyEngineering.net
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
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: Sl.No
Name of the Apparatus
Qty
1
8085 Microprocessor kit
1
2
+5Volts Power Supply
1
ww 3
w.E
Keyboard Connector
ALGORITHM:
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.
6. If carry the increment the register C by one. 7. Store the result to memory location.
VVIT
-
Visit : www.EasyEngineering.net
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
6
FLOW CHART: (8 bit Addition) START
Clear the “C” Register
Initialize Memory Location and get the first data from memory
ww
ge
Get the Second data from memory Location
w.E
ge
ge
asy
Add the first and Second data’s
En
If carry=1?
Yes
NO
gin
Increment “C” register by One
ge
ge
VVIT
-
Visit : www.EasyEngineering.net
Store the Result to Memory Location
eer
ing
.ne t
STOP
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
7
PROGRAM:
ADDRESS
LABEL
8000
ww
w.E Loop1
MNEMONICS
OPCODE
COMMENTS
MVI C,00
Clear the “C” Register
LXI H,9200
Initialize the memory pointer
MOV A,M
Move the First Data to A Register
INX H
Increment the memory pointer
ADD M
Add First and Second Data
JNC LOOP1
Jump if No Carry to loop1
INR C
Increment the “C” register by one
STA 9500
STA 9501
Store the Result Move the Carry result to Register “A” Store the Carry Result
HLT
Stop the program
asy
MOV A,C
En
Input: Memory location
gin
eer
Data
9200 9201
Output: Memory location 9500
ing
.ne t
Data
9501
Result : Thus the addition of two 8 bit data’s was executed using the 8085 microprocessor. VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
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
Sl.No 1 2
w.E 3
ALGORITHM:
Name of the Apparatus 8085 Microprocessor kit +5Volts Power Supply
Qty 1 1
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.
VVIT
-
Visit : www.EasyEngineering.net
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
9
FLOW CHART: (8 bit Subtraction)
START
Clear the “C” Register
ww
w.E
Initialize Memory Location and get the first data from memory
ge
asy
Get the Second data from memory Location
ge
ge
En
gin
Subtract the first and Second data’s
If carry=1?
YES
NO
Increment “C” register by One
ge
eer
ing
.ne t
Store the Result to Memory Location STOP
ge
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
10
PROGRAM:
ADDRESS LABEL 8000
ww
w.E Loop1
MNEMONICS
Clear the “C” Register
LXI H,9200
Initialize the memory pointer
MOV A,M INX H
Move the First Data to A Register Increment the memory pointer
SUB M
Subtract First and Second Data
JNC LOOP1
Jump if No Carry to loop1
INR C
Increment the “C” register by one Complement the Accumulator
CMA
asy
En
STA 9500
HLT
Visit : www.EasyEngineering.net
Add by one for two’s complement Store the Result
ADI 01
STA 9501
-
COMMENTS
MVI C,00
MOV A,C
VVIT
OPCODE
gin
Move the Carry result to Register “A” Store the Carry Result
eer
Stop the program
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
11
Input: Memory location 9200 9201
Data
Output:
ww
Memory location 9500 9501
Data
w.E
asy
En
gin
eer
ing
.ne t
RESULT : Thus the subtraction of two numbers was performed using the 8085 microprocessor.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
12
Exp No : 3 Date : PROGRAM FOR 8 BIT MULTIPLICATION USING 8085 AIM: To write an assembly language program for multiplication of two 8 bit data using 8085 microprocessor.
APPARATUS REQUIRED: Sl.No
Name of the Apparatus
Qty
1
8085 Microprocessor kit
1
2
+5Volts Power Supply
1
3
Keyboard Connector
1
ww
w.E
ALGORITHM:
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. 5. Add the Memory Data and A Register. 6. Decrement the register ‘c’ by one
gin
7. Check the register “C’ is Zero otherwise repeat step 5. 8. Store the result to memory location.
eer
PROGRAM :
ADDRESS
LABEL
8000
Loop1
VVIT
-
Visit : www.EasyEngineering.net
MNEMONICS
MVI LXI MOV INX ADD DCR JNZ STA HLT
A,00 H,9200 C,M H M C LOOP1 9500
OPCODE
ing
.ne t
COMMENTS
Clear the “A” Register Initialize the memory pointer Move the First Data to C Reg Increment the memory pointer Add First and Second Data Decrement C register by one Jump if No Zero to loop1 Store the Result Stop the program
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
13
FLOW CHART: (8 bit Multiplication) START
Clear the “C” Register
Initialize Memory Location and get the first data from memory
ge
ww
Get the Second data from memory Location
w.E
AddgeRegister “A” and memory Register then decrement register “c” by 1
ge
asy
If C=0?
Yes
En
NO
gin
Store the Result to Memory Location
ge
VVIT
-
Visit : www.EasyEngineering.net
STOP
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
14
Input: Memory location 9200
Data
9201
Output: Memory location
Data
ww
9500
w.E
asy
En
gin
eer
ing
.ne t
RESULT: Thus the multiplication of two numbers was performed using the 8085 microprocessor.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
15
Exp No : 4 Date : PROGRAM FOR 8 BIT DIVISION USING 8085 AIM: To write an assembly language program for division of two 8 bit data using 8085 microprocessor.
APPARATUS REQUIRED: Sl.No
Name of the Apparatus
Qty
1
8085 Microprocessor kit
1
2
+5Volts Power Supply
1
3
Keyboard Connector
1
ww
w.E
ALGORITHM:
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” 9. If No Carry go to step 6 10. Store the result to memory location.
VVIT
-
Visit : www.EasyEngineering.net
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
16
FLOWCHART: (8 bit Division) Start Get the First Data from memory to register ”A”
Get the Second Data from memory
Compare register A and M register
ww
Clear the register “C”
w.E
If Cy=1?
asy
Yes
No
Subtract register M from register A
En
gin
Compare register A and M register
No
If Cy=1? Yes
Store the result to Memory Location
STOP
VVIT
-
Visit : www.EasyEngineering.net
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
17
PROGRAM:
ADDRESS
LABEL
8000
MNEMONICS
OPCODE
MVI C,00
Clear the “C” Register
LXI H,9200
Initialize the memory pointer
MOV A,M
Move the First Data to A Register Increment the memory pointer
INX H
JC Loop1
Compare register A and M data’s If carry jump to loop1
SUB M
Subtract register A and M Data
INR C
Increment C register by one
CMP M
JNC Loop2
Compare register A and M data’s Jump if No Carry to loop2
STA 9500
Store the Quotient Result
CMP M
ww
Loop2
w.E
asy
En
MOV A,C
STA 9501 HLT Loop1
MVI A,00 STA 9500
VVIT
-
Visit : www.EasyEngineering.net
COMMENTS
gin
Move register C to A Store the Remainder Result
eer
Stop the program
ing
Clear the accumulator Store the result
STA 9501
Store the result
HLT
stop
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
18
Input:
Memory location
Data
9200 9201
Output:
ww
Memory location
Data
w.E 9500 9501
asy
En
gin
eer
ing
.ne t
RESULT : Thus the division of two numbers was performed using the 8085 microprocessor.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
19
Exp No : 5 Date : LARGEST NUMBER OF PROGRAM IN A GIVEN ARRAY AIM: To write an assembly language program to find the largest number in a given array using 8085 microprocessor.
APPARATUS REQUIRED: Sl.No
ww 1 2 3
Name of the Apparatus
Qty
8085 Microprocessor kit
1
w.E
ALGORITHM:
+5Volts Power Supply
1
Keyboard Connector
1
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. 5. Compare the register A and M .
eer
6. If No carry jump to loop2. 7. Move the register M to A. 8. Decrement the register B by one.
ing
.ne t
9. Check register B is Zero otherwise go to step 4. 10. Store the Largest value to memory location. 11. Stop.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
20
FLOWCHART: (LARGEST NUMBER) START Initialize the Memory location Load the counter to register B Move the first data to register A
ww
w.E
Increment the memory location Compare the register A and M
asy
En
If cy=0?
No
No
Yes
gin
Move the memory data to register A
Check Reg B=0?
Yes
eer
ing
.ne t
Move the result to memory location
STOP
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
21
PROGRAM:
ADDRES S
LABEL
8000
ww
w.E Loop1
MNEMONICS
OPCOD E
LXI H,9100
Initialize the memory pointer
MVI B,04
Load the counter to register B
MOV A,M INX H
Move the First Data to A Register Increment the memory pointer
CMP M
Compare register A and M datas
asy
If No carry jump to loop2
JNC Loop2
En
Move register M to A
MOV A, M
LOOP2
DCR B CMP M
JNZ Loop1 STA 9500 HLT
VVIT
-
Visit : www.EasyEngineering.net
COMMENTS
gin
Decrement B register by one Compare register A and M data’s Jump if No Zero to loop1
eer
ing
Store the Result to memory Stop
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
22
Input: Memory location
Data
9100 9101 9102 9103
ww
w.E
Output:
asy
Memory location 9500
En Data
gin
eer
ing
.ne t
RESULT: was
VVIT
Thus the program to find the largest number in a given array using 8085 microprocessor executed.
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
23
Exp No : 6 Date : SMALLEST NUMBER OF PROGRAM IN A GIVEN ARRAY AIM: To write an assembly language program to find the smallest number in a given array using 8085 microprocessor.
APPARATUS REQUIRED: Sl.No
Name of the Apparatus
Qty
1
8085 Microprocessor kit
1
2
+5Volts Power Supply
1
Keyboard Connector
1
ww
w.E
3
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. 5. Compare the register A and M .
eer
6. If carry jump to loop2. 7. Move the register M to A. 8. Decrement the register B by one.
ing
.ne t
9. Check register B is Zero otherwise go to step 4. 10. Store the Largest value to memory location. 11. Stop.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
24
FLOWCHART: (Smallest Number) START Initialize the Memory location Load the counter to register B Move the first data to register A Increment the memory location
ww
Compare the register A and M
w.E
asy
Yes
If cy=0?
En No
gin
Move the memory data to register A
Check B=0? No Yes
Move the result to memory location
eer
ing
.ne t
STOP
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
25
PROGRAM: ADDRESS
LABEL
8000
MNEMONICS
OPCODE
Initialize the memory pointer Load the counter to register B Move the First Data to A Register Increment the memory pointer Compare register A and M datas If carry jump to loop2 Move register M to A Decrement B register by one Compare register A and M data’s Jump if No Zero to loop1 Store the Result to memory Stop
LXI H,9100 MVI B,04 MOV A,M Loop1
ww
INX H CMP M JC Loop2 MOV A, M DCR B CMP M
Loop2
w.E
Input: Memory location 9100 9101 9102 9103
JNZ Loop1 STA 9500 HLT
asy Data
En
COMMENTS
Output:
gin
eer
Memory location
9500
Data
ing
.ne t
RESULT: Thus the program to find the smallest number in a given array using 8085 microprocessor was executed.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
26
Exp No : 7 Date : PROGRAM SORT ASCENDING OREDR IN A GIVEN ARRAY AIM: To write an assembly language program to sort ascending order in a given array using 8085 microprocessor.
APPARATUS REQUIRED: Sl.No
Name of the Apparatus
Qty
1
8085 Microprocessor kit
1
ww 2 3
w.E
+5Volts Power Supply
1
Keyboard Connector
1
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. 5. Compare the register A and M .
eer
6. If carry jump to loop2. 7. Move the register M to A. 8. Decrement the register B by one.
ing
.ne t
9. Check register B is Zero otherwise go to step 4. 10. Store the Largest value to memory location. 11. Stop.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
27
FOWCHART: (Ascending Order) START Initialize counter1=09 Initialize memory pointer, Initialize counter2= 09 Get the number
Increment the memory pointer
ww
w.E
No
Is (pointer-1)>(pointer)?
asy
Yes
Interchange the content
En
gin
Decrement counter2 and Increment memory pointer No
No
Is counter2=0?
Yes
Decrement counter 1
Is counter1=0?
eer
ing
.ne t
Yes
STOP
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
28
PROGRAM: ADDRESS
LABEL
8000
MVI LXI MVI MOV
L3 L2
OPCODE
B,09 H,9100 C,09 A,M
INX H CMP M
ww
w.E L1
VVIT
MNEMONICS
-
Visit : www.EasyEngineering.net
JC L1 MOV D, M MOV M,A DCX H MOV M,D INX H DCR C JNZ L2 DCR B JNZ L3 HLT
asy
En
gin
COMMENTS Load the counter to register B Initialize the memory pointer Load the counter value Move the First Data to A Register Increment the memory pointer Compare register A and M data’s If carry jump to loop1 Move register M to D Move register M to A Decrement memory pointer Move register M to D Increment memory pointer Decrement B register by one Jump if No Zero to loop2 Decrement B register by one Jump if No Zero to loop3 Stop
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
29
Input: Memory location 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109
Data
ww
w.E
Output:
Memory location 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109
asy
En
Data
gin
eer
ing
.ne t
RESULT: Thus the program of sort the ascending order in given array was executed by using 8085. VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
30
Exp No : 8 Date : PROGRAM SORT DESCENDING OREDR IN A GIVEN ARRAY AIM: To write an assembly language program to sort descending order in a given array using 8085 microprocessor.
APPARATUS REQUIRED: Sl.No
Name of the Apparatus
Qty
1
8085 Microprocessor kit
1
ww 2 3
w.E
+5Volts Power Supply
1
Keyboard Connector
1
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. 5. Compare the register A and M .
eer
6. If no carry jump to loop2. 7. Move the register M to A. 8. Decrement the register B by one.
ing
.ne t
9. Check register B is Zero otherwise go to step 4. 10. Store the Largest value to memory location. 11. Stop.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
31
FLOWCHART: (Descending order) START
Initialize counter1=09 Initialize memory pointer, Initialize counter2= 09 Get the number
ww
w.E
No
Increment the memory pointer
asy
Yes
Is (pointer-1)>(pointer)?
En
gin
Interchange the content No
eer
Decrement counter2 and Increment memory pointer Yes Is counter2=0?
Decrement counter 1
ing
.ne t
Yes
Is counter1=0?
STOP
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
32
PROGRAM:
ADDRESS
LABEL
8000
MNEMONICS
L3 L2
OPCODE
MVI B,04
Load the counter to register B
LXI H,9100
Initialize the memory pointer
MVI C,04
Load the counter value
MOV A,M
Move the First Data to A Register Increment the memory pointer
INX H
JNC L1
Compare register A and M datas If carry jump to loop1
MOV D, M
Move register M to D
MOV M,A
Move register M to A
DCX H
Decrement memory pointer
MOV M,D
Move register M to D
INX H
Increment memory pointer
CMP M
ww
w.E
asy
L1
DCR C JNZ L2 DCR B JNZ L3 HLT
VVIT
-
Visit : www.EasyEngineering.net
COMMENTS
En
gin
Decrement B register by one Jump if No Zero to loop2
eer
Decrement B register by one
ing
Jump if No Zero to loop3 Stop
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
33
Input: Memory location 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109
Data
ww
w.E
Output:
asy
Memory location 9100 9101 9102 9103 9104 9105 9106 9107 9108 9109
En
Data
gin
eer
ing
.ne t
RESULT: Thus the program of sort the descending order in given array was executed by using 8085.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
34
EX.NO:9 Date : PROGRAM FOR CODE CONVERSION – DECIMAL TO HEX AIM: To write an assembly language program to convert a given decimal number into hexadecimal number using 8085 microprocessor.
APPARATUS REQUIRED:
ww Sl.No
Name of the Apparatus
Qty
1
8085 Microprocessor kit
1
w.E
2 3
+5Volts Power Supply
1
Keyboard Connector
1
ALGORITHM:
asy
En
1. Initialize the Memory Pointer. 2. Increment B register.
gin
eer
3. Increment accumulator by one and adjust to decimal every time.
ing
4. Compare the given decimal number with accumulator value.
5. When both matches, the equivalent hexadecimal value is in B register. 6. Store the resultant in memory location.
VVIT
-
Visit : www.EasyEngineering.net
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
35
FLOWCHART : (DECIMAL TO HEX) START Initialize Memory Pointer
Clear the Accumulator and B register Increment the B register and add register A by one
ww
Decimal adjust accumulator
w.E No
Is A=M?
asy
Yes
En
Store the result to memory Yes
gin
STOP
VVIT
-
Visit : www.EasyEngineering.net
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
36
PROGRAM:
ADDRESS
LABEL
8000
Loop1
ww
w.E
MNEMONICS LXI MVI MVI INR ADI DAA CMP JNZ MOV STA HLT
M Loop1 A,B 9500
Memory location
En Data
9100
Output: Memory location 9500
Data
COMMENTS Initialize the memory pointer Clear the Accumulator Clear the B register Increment the B register Increment the A register Decimal Adjust Accumulator Compare A and M register Jump if No Zero to loop1 Move register B to A Store the result to memory Stop the program
H,9100 A,00 B,00 B 01
asy
Input:
OPCODE
gin
eer
ing
.ne t
RESULT: Thus the program of conversion of decimal to hex given data was executed by using 8085.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
37
Exp No:10 Date : PROGRAM FOR CODE CONVERSION – HEXA DECIMAL TO DECIMAL AIM: To write an assembly language program to convert a given hexadecimal number into decimal number using 8085 microprocessor.
APPARATUS REQUIRED: Sl.No
ww
Name of the Apparatus
1 2 3
Qty
8085 Microprocessor kit
1
w.E
+5Volts Power Supply
1
Keyboard Connector
1
ALGORITHM:
asy
En
1. Initialize the Memory Pointer. 2. Increment B register.
gin
eer
3. Increment accumulator by one and adjust to decimal every time.
ing
4. Compare the given decimal number with B register value.
5. When both match, the equivalent decimal value is in A register. 6. Store the resultant in memory location.
VVIT
-
Visit : www.EasyEngineering.net
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
38
FLOWCHART : (Decimal To Hex) START Initialize Memory Pointer
Clear the Accumulator, Band C register Increment B register and add register A by one
ww
Decimal adjust accumulator
w.E
Is Cy=1?
asy No
Yes
En
Increment the register C by one
gin
Transfer A to D and B to A
Is A=M?
eer
No Yes
Store the Result
ing
.ne t
STOP
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
39
PROGRAM: ADDRESS
LABEL
8000
MNEMONICS
Loop1
ww
NEXT
w.E
LXI MVI MVI MVI INR ADI DAA JNC INR MOV MOV CMP MOV JNZ STA MOV STA HLT
NEXT C D,A A,B M A,D Loop1 9500 A,C 9501
En
Input: Data
Output: Memory location 9500
Data
COMMENTS Initialize the memory pointer Clear the Accumulator Clear the B register Clear the C register Increment the B register Increment the A register Decimal Adjust Accumulator If no carry go to next loop Increment register C by one Transfer A to D Transfer B to A Compare A and M register Transfer D to A Jump if No Zero to loop1 Store the result to memory Move register B to A Store the result to memory Stop the program
H,9100 A,00 B,00 C,00 B 01
asy
Memory location 9100
OPCODE
gin
eer
ing
.ne t
RESULT: Thus the program of conversion of hexadecimal to decimal given data was executed by using 8085.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
40
EX.NO:11 DATE : PROGRAM FOR CODE CONVERSION – BINARY TO ASCII AIM: To write an assembly language program to convert a given binary number into ASCII number using 8085 microprocessor.
APPARATUS REQUIRED:
ww Sl.No
Name of the Apparatus
Qty
1
8085 Microprocessor kit
1
w.E
2 3
+5Volts Power Supply
1
Keyboard Connector
1
ALGORITHM:
asy
1. Start the program
En
gin
2. Load the data from address 9100 to A
3. Compare register A and data 0Ah(decimal 10). 4. If no carry add 37h with register A. 5. If Carry add 30h with register A. 6. Store the result to memory location.
VVIT
-
Visit : www.EasyEngineering.net
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
41
FLOWCHART : ( Binary to ASCII) START Get the data to Accumulator
Compare register A and Data 0Ah
ww
No
w.E
Is Cy=1?
asy
Add register A with 07
En
Yes
gin
Add register A with 30
Store the result
STOP
VVIT
-
Visit : www.EasyEngineering.net
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
42
PROGRAM:
ADDRESS
LABEL
8000
MNEMONICS
ww
w.E
asy
Memory location
En Data
9100
Output:
Memory location 9500
COMMENTS Get the data to Accumulator Clear the Accumulator Compare register A and data 10 If carry jump to loop1 Add A with 07 Add A with 30 Store the result to memory Stop the program
LDA 9100 MVI A,00 CPI 0A JC LOOP1 ADI 07H ADI 30H STA 9500 HLT
LOOP1
Input:
OPCODE
Data
gin
eer
ing
.ne t
RESULT: Thus the program of conversion of binary to ASCII given data was executed by using 8085.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
43
Exp No : 12 DATE : PROGRAM FOR CODE CONVERSION – ASCII TO BINARY AIM: To write an assembly language program to convert a given ASCII number into binary number using 8085 microprocessor.
APPARATUS REQUIRED: Sl.No
Name of the Apparatus
Qty
1
8085 Microprocessor kit
1
ww 2 3
w.E
+5Volts Power Supply
1
Keyboard Connector
1
ALGORITHM:
asy
1. Start the program
En
2. Load the data from address 9100 to A 3. Compare register A and data 3Ah.
4. If no carry subtract 37h with register A. 5. If carry subtract 30h with register A. 6. Store the result to memory location.
VVIT
-
Visit : www.EasyEngineering.net
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
44
FLOWCHART : (ASCII TO BINARY) START Get the data to Accumulator
ww
Compare register A and Data 3AH
w.E Yes
asy
Is Cy=1? Yes
Subtract register A with 07
En
No
gin
Subtract register A with 30
Store the result
STOP
VVIT
-
Visit : www.EasyEngineering.net
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
45
PROGRAM:
ADDRESS
LABEL
8000
ww
LOOP1
w.E
MNEMONICS
Get the data to Accumulator
MVI A,00
Clear the Accumulator
CPI 3A JC LOOP1
Compare register A and data 3Ah If carry jump to loop1
ADI 07H
Add A with 07
ADI 30H
Add A with 30
STA 9500
Store the result to memory
HLT
Stop the program
Memory location
En Data
9100
Output: Memory location 9500
COMMENTS
LDA 9100
asy
Input :
OPCODE
Data
gin
eer
ing
.ne t
RESULT: Thus the program of conversion of ASCII to binary given data was executed by using 8085.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
46
EX.NO:13 DATE : PROGRAM FOR INTERFACING OF ADC WITH 8085 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: Sl. No 1
Name of the Apparatus 8085 Microprocessor kit
2
+5Volts Power Supply
1
Keyboard Connector
1
ADC Interfacing kit
1
Multimeter
1
ww 3 4 5
w.E
asy
Working procedure for ADC:
En
Qty 1
gin
Connect the 5v power supply to trainer kit and adc chord.
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. Vary the pot in the adc chord.
.ne 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.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
47
8085 ADDRESS: 8255 control register address – 23H 8255 port A address
-20H
8255 port B address
-21 H
8255 port C address
-22H
ww
w.E
asy
En
VVIT
-
Visit : www.EasyEngineering.net
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
48
PROGRAM: ADDRESS
LABEL
9000
OPCODE
w.E delay Loop1 Loop2
Analog Input
OUT 23 MVI A,01 OUT 21 MVI A,FF OUT 22 MVI A,00 OUT 22 MVI A,FF OUT 22 CALL 9100 IN20 RST 1 MVI B,0F MVI A,FF NOP NOP DCR A JNZ loop2 DCR B JNZ loop1 RET
asy
En
COMMENTS Control Word for port A as input and port c as output Out in control RE Select input for MUX
MVI A,90
ww 9100
MNEMONICS
Port C is enable Start of Conversion(SOC)
gin
Digital output
Delay subroutine End of conversion(EOC) Break point Delay Count Load data FF to register A No operation No operation Decrement register A If no zero jump to loop2 Decrement register B by one If no zero jump to loop1 Return to main Program
eer
ing
.ne t
RESULT : Thus the conversion of a analog signal into and digital signal was executed using interfacing of ADC with 8085.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
49
EX.NO:14 DATE : PROGRAM FOR INTERFACING OF DAC WITH 8085 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: Sl.No
Name of the Apparatus
Qty
1
8085 Microprocessor kit
1
2
+5Volts Power Supply
1
3
Keyboard Connector
w.E
1
DAC Interfacing kit
1
ww 4 5
asy
CRO
Working procedure for DAC:
1
En
gin
Connect the 5v power supply to trainer kit and dac(0800) chord. Connect the 26-pin connector from the kit to dac(0800) chord.
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 t
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.
i)SQUARE WAVE FORM ALGORITHM: 1. Load the initial value (00) to Accumulator and move it to DAC. 2. Call the delay program 3. Load the final value (FF) to accumulator and move it to DAC. 4. Call the delay program. 5. Repeat steps 2 to 5.
6. Execute the program and using a CRO, verify that the waveform at the DAC2 output is a square-wave. Modify the frequency of the square-wave, by varying the time delay.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
50
8085 ADDRESS: 8255 control register address – 23H 8255 port A address
-20H
8255 port B address
-21 H
8255 port C address
-22H
ww
w.E
asy
En
VVIT
-
Visit : www.EasyEngineering.net
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
51
PROGRAM: SQUARE WAVE FORM ADDRESS
LABEL
9000 LOOP1
ww 9100
VVIT
w.E delay Loop1 Loop2
-
Visit : www.EasyEngineering.net
MNEMONICS MVI A,80 OUT 23 MVI A,FF OUT 21 CALL 9100 MVI A,00 OUT 21 CALL 9100 JMP LOOP1(9004) MVI C,FF MVI B,FF NOP NOP DCR B JNZ loop2 DCR C JNZ loop1 RET
asy
En
OPCODE
COMMENTS Control Word Out in control REG High Input output in port B Delay subroutine Low Input output in port B Delay subroutine Jump To Start
gin
Delay Count Load data FF to register A No operation No operation Decrement register B If no zero jump to loop2 Decrement register C by one If no zero jump to loop1 Return to main Program
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
52
SQUARE WAVE FORMS ;
V
ww
time
w.E
asy
En
VVIT
-
Visit : www.EasyEngineering.net
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
53
II) SAW TOOTH GENERATION: 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
asy
PROGRAM: SAW TOOTH WAVE FORM
ADDRESS
LABEL
9000
En
MNEMONICS MVI A,80 OUT 23
VVIT
gin
OPCODE
COMMENTS
eer
Control Word
ing
Out in control REG
MVI A,00
LOOP1
OUT 21
output in port B
INR A
Increment register A by one
JNZ LOOP1
If zero jump to loop1
JMP START
Jump To Start
-
Visit : www.EasyEngineering.net
Low Input
.ne t
START
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
54
ww
w.E
SAW TOOTH WAVE FORM :
asy
V
En
VVIT
-
Visit : www.EasyEngineering.net
gin
time
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
55
(iii) TRIANGULAR WAVE GENERATION: ALGORITHMS: 1. Load the initial value (00) to Accumulator. 2. Move the accumulator content to DAC 3. Increment the accumulator content by 1. 4. If accumulator content is zero proceed to next step. Else go to step 3. 5. Load value (FF) to accumulator. 6. Move the accumulator content to DAC.
ww
7. Decrement the accumulator content by 1. 8. If accumulator content is zero go to step 2. Else go to step 2.
w.E
PROGRAM: TRIANGULAR WAVE FORM
ADDRESS 9000
asy
LABEL
START LOOP1
LOOP2
MNEMONICS
En
MVI L,00 MOV A,L OUT 21 INR L JNZ LOOP1 MVI L,FF MOVA,L OUT 21 DCR L JNZ LOOP2 JMP START
OPCODE
gin
COMMENTS Transfer 00 to register L Transfer L to A Output in control register Increment register L If no zero jump to loop1 Transfer FF to register L Transfer L to A Output in control register Decrement register L If no zero jump to loop2 Jump to start loop
eer
ing
.ne t
TRIANGULAR WAVE FORM : V
time
RESULT : Thus the conversion of a digital signal into an analog signal was executed using interfacing of DAC with 8085. VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
56
EXP.No :15 DATE : PROGRAM FOR KEYBOARD AND DISPLAY INTERFACING WITH 8085 AIM: To interface 8279 Programmable Keyboard Display Controller with 8085 Microprocessor.
APPARATUS REQUIRED:
ww Sl.No 1 2 3 4
Name of the Apparatus
w.E
8085 Microprocessor kit
1
+5Volts Power Supply
1
Keyboard Connector
1
asy
En
Keyboard and Display Interfacing kit
PROGRAM: 7 SEGMENT DISPLAY ADDRESS
LABEL
9000 9002 9004 9006 9008 900A 900C 900E 9010 9012 9014 9015 9018 9019 901B VVIT
Qty
-
Visit : www.EasyEngineering.net
MNEMONICS MVI MVI OUT MVI OUT MVI OUT MVI MVI OUT DCR JNZ MOV OUT JMP
C,BA A,12 71 A,3E 71 A,A0 71 B,08 A,00 70 B 9012 A,C 70 9019
1
gin
eer
OPCODE
ing
COMMENTS
.ne t
7 segment code for 2 control word Control port Frequency division Control register Display / write inhibit Control register Clear display
Take the character to display
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
57
a f
g
b
e
c d
Char
D
C
B
A
E
F
G
H
HEX CODE
0
1
1
1
1
1
1
0
0
FC
1
0
1
1
0
0
0
0
0
60
ww
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.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
58
EXP.No: 16 DATE : PROGRAM FOR INTERFACING - TRAFFIC LIGHT CONTROLLER WITH 8085 AIM: To write an assembly language program to simulate the traffic light at an intersection using a traffic light interface with 8085 microprocessor.
ww
APPARATUS REQUIRED: Sl.No 1 2 3 4
w.E
Name of the Apparatus 8085 Microprocessor kit
Qty 1
+5Volts Power Supply
asy
1
Keyboard Connector
1
En
Traffic Light control Interfacing kit
WORKING PROCEDURE: Connect the 5V supply to trainer kit.
Connect the 26 pin FRC from the kit. Switch on the power supply. Assemble the program. Execute it and output display by LED.
8085 ADDRESS: PORT CWR PORT A PORT B PORT C
VVIT
-
Visit : www.EasyEngineering.net
gin
1
eer
ing
.ne t
ADDRESS 23 20 21 22
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
59
PROGRAM: TRAFFIC LIGHT CONTROLLER ADDRESS 8500 8502 8504 8506 8508 850A 850C
ww 850F
8512 8514 8516 8519 851C 851E 8520 8522 8524 8527 8529 852B 852E 8530 8532 8534 8536 8539 853B 853D 853F 8541 8543 VVIT
LABEL
MNEMONICS
OPCODE
COMMENTS
MVI A,80 All port as output Out 23 For starting right turn in N-S sides & pedestrian stopping MVI A,0F For pedestrian Out 21 Signal MVI A,4D For green LEDs in N-S OUT 20 Direction CALL Sequence Delay DELAY(8569) CALL Amber delay AMBER(855F) For stopping vehicles in N-S direction & starting E-W direction MVI A,8B For stopping N-S sides OUT 20 For starting E-W sides CALL DELAY Sequence Delay CALL AMBER Amber delay For starting right turn in N-S sides & stopping E-W sides MVI A,49 For free left in all sides OUT 20 For stopping E-W sides MVI A,01 For right turn in N-S sides OUT 22 CALL DELAY MVI A,07 OUT 22 CALL AMBER Stopping Right Turn In N-S Sides & Starting Turn In E-W Sides MVI A,89 OUT 20 MVI A,02 OUT 22 CALL DELAY MVI A,00 OUT 22 MVI A,30 OUT 20 MVI C,04 CALL DELAY For starting Pedestrian
w.E
-
Visit : www.EasyEngineering.net
asy
En
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
8546 8548 854A 854C 854E 8550 8553 8555 8257 8259
MVI A,C0 OUT 20 MVI A,F0 OUT 21 MVI C,10 CALL DELAYSUB MVI A,30 OUT 20 MVI C,08 CALL DELAYSUB
825C
JMP CONTINUE
ww 855F 8561
AMBER
MVI A,39
8568 8569
DELAY
OUT 20
w.E
8563 8568
MVI C,08 CALL DELAYSUB
asy RET
En
MVI C,40
856B
gin
CALL DELAYSUB
856E 856F
RET DELAYSUB BACK2
MVI D,FF
BACK1
MVI A,FF
BACK
NOP DCR A JNZ BACK
eer
ing
.ne t
DCR D JNZ BACK1 MOV A,C JZ OUT DCR C JNZ BACK2 OUT
VVIT
60
-
Visit : www.EasyEngineering.net
RET
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
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.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
62
EXP.No : 17 DATE: PROGRAM FOR I/O PORT SERAIL COMMUNICATION WITH 8085 AIM: To write a program to initiate 8251 and to check the transmission and reception of character. APPARATUS REQUIRED: Sl.No 1 2
ww 3 4
Name of the Apparatus 8085 Microprocessor kit +5Volts Power Supply
Qty 1 1
w.E
Keyboard Connector
1
8251/8253 Interfacing kit
1
asy
ALGORITHM:
En
1. Initialize timer (8253) IC
gin
2. Move the Mode command word (36H) to A reg. 3. Output it port address CE
4. Move the command instruction word (37H) to A reg. 5. Output it to port address C8
eer
PROGRAM: SQUARE WAVE GENERATION ADDRESS
LABEL
9000
VVIT
-
Visit : www.EasyEngineering.net
MNEMONICS MVI OUT MVI OUT MVI OUT HLT
A,36 CE A,0A C8 A,00 C8
OPCODE
ing
.ne t
COMMENTS
Channel 0 in mode 3 Send mode control word LSB of count Write count to register MSB of count Write count to register Stop the program
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
63
V
time
ww
w.E
asy
En
gin
eer
ing
.ne t
RESULT: Thus the program to initiate 8251 was written and executed.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
64
Exp No : 18 Date : PROGRAM FOR 8 BIT ADDITION USING 8051 AIM: To write an assembly language program for addition of two 8 bit data using 8051 microcontroller.
APPARATUS REQUIRED: Sl.No
Name of the Apparatus
Qty
1
8051 Microcontroller kit
1
2
+5Volts Power Supply
1
3
w.E
1
ww
Keyboard Connector
ALGORITHM:
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.
6. If carry the increment the register ‘C’ by one. 7. Store the result to memory location.
VVIT
-
Visit : www.EasyEngineering.net
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
65
FLOW CHART: (8 bit Addition)
START
Clear the “Cy” Flag and R0 register
ww
Initialize Memory Location and get the first data from memory
w.E
ge
ge
Get the Second data from memory
asy
En
Add the first and Second data’s
ge
If carry=1?
gin
Yes
Increment “R0” register by One
ge
ge
VVIT
-
Visit : www.EasyEngineering.net
eer
NO
Store the Result to Memory Location
ing
.ne t
STOP
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
66
PROGRAM: ADDRESS
LABEL
8000
MNEMONICS
OP CODE
Clear the “Carry” Flag
CLR C MOV R0,#00 MOV DPTR,#9200 MOVX A,@DPTR MOV B,A INC DPTR MOVX A,@DPTR
ww
w.E Loop1
ADD A,B JNC Loop1 INR R0
asy
HLT
COMMENTS
En
MOV DPTR,#9500 MOVX @DPTR,A MOV A,R0 INC DPTR MOVX @DPTR,A SJMP : HLT
gin
Input: Memory location 9200 9201
Data
Memory location
Data
Initialize the memory pointer Move the First Data to A Reg Transfer Data To B Increment the memory pointer Get the second data from memory Add First and Second Data Jump if No Carry to loop1 Increment the “C” register by one Initialize the memory pointer Store The Result Move the Carry result to Reg “A” Increment the memory pointer Store the Carry Result Stop the program
eer
ing
.ne t
Output:
9500 9501
RESULT : Thus the addition of two numbers was performed using the 8085 microprocessor .
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
67
Exp No : 19 Date : PROGRAM FOR 8 BIT SUBTRACTION USING 8051 AIM: To write an assembly language program for subtraction of two 8 bit data using 8051 microcontroller.
APPARATUS REQUIRED: Sl.No
Name of the Apparatus
Qty
1
8051 Microcontroller kit
1
2
+5Volts Power Supply
1
3
w.E
1
ww
Keyboard Connector
ALGORITHM:
asy
1. Initialize the memory pointer to data location.
En
2. Get the first Data from memory and move to register A.
gin
3. Get the second data from memory location. 4. Subtract the first and second data.
5. Store the result to memory location.
VVIT
-
Visit : www.EasyEngineering.net
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
68
FLOW CHART: (8 bit Subtraction) START
Initialize Memory Location and get the first data from memory
ge
ww
Get the Second data from memory location
w.E
Subtract the first and Second data’s
ge
asy
ge
En
Store the Result to Memory Location
ge
VVIT
-
Visit : www.EasyEngineering.net
STOP
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
69
PROGRAM: ADDRESS
LABEL
8000
MNEMONICS
OPCODE
Initialize the memory pointer Move the First Data to A Reg Transfer Data To B Increment the memory pointer Get the second data from memory Add First and Second Data Initialize the memory pointer Store The Result Stop the program
MOV DPTR,#9200 MOVX A,@DPTR MOV B,A INC DPTR MOVX A,@DPTR
ww
SUBB A,B MOV DPTR,#9500
w.E HLT
Input:
MOVX @DPTR,A SJMP : HLT
asy
Memory location 9200 9201
En Data
gin
Output:
Memory location
Data
COMMENTS
eer
ing
.ne t
9500
RESULT : Thus the subtraction of two numbers was performed using the 8085 microprocessor.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
70
Exp No : 20 Date : PROGRAM FOR 8 BIT MULTIPLICATION USING 8051 AIM: To write an assembly language program for multiplication of two 8 bit data using 8051 microcontroller. APPARATUS REQUIRED: Sl.No
ww 1 2 3
Name of the Apparatus
Qty
8051 Microcontroller kit
1
w.E
+5Volts Power Supply
1
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. 5. Store the result to memory location.
VVIT
-
Visit : www.EasyEngineering.net
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
71
FLOW CHART: ( 8 bit Multiplication)
START
Initialize Memory Location and get the first data from memory
ww
ge
Get the Second data from memory
w.E
ge
En
Initialize the output memory location
ge
ge
gin
Store the Result to Memory Location
ge
VVIT
asy
Multiply first and second data
-
Visit : www.EasyEngineering.net
STOP
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
72
PROGRAM:
ADDRESS
LABEL
8000
MNEMONICS
OPCODE
MOV DPTR,#9200
Initialize the memory pointer
MOVX A,@DPTR
Move the First Data to A Register Transfer Data To B
MOV B,A
MOV DPTR,#9500
Increment the memory pointer Get the second data from memory Multiply First and Second Data Initialize the memory pointer
MOVX @DPTR,A
Store The LSB Result
INC DPTR
Increment the data pointer
INC DPTR
ww
MOVX A,@DPTR
w.E
MUL AB
asy
MOV B,A
En
MOVX @DPTR,A HLT
COMMENTS
SJMP
: HLT
gin
Input: Memory location
Data
9200 9201
Transfer B to A Store the MSB result
eer
Stop the program
ing
.ne t
Output: Memory location
Data
9500 9501
RESULT: Thus the multiplication of two numbers was performed using the 8085 microprocessor.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
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: Sl.No 1
Name of the Apparatus
Qty
8051 Microcontroller kit
1
ww 2
+5Volts Power Supply
1
3
Keyboard Connector
1
w.E
ALGORITHM:
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.
VVIT
-
Visit : www.EasyEngineering.net
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
74
FLOW CHART: (8 bit Division)
START
Initialize Memory Location and get the first data from memory
ww
w.E
ge
ge
asy
Divide first and second data
En
Initialize the output memory location
ge
ge
gin
Store the Result to Memory Location
ge
VVIT
Get the Second data from memory
-
Visit : www.EasyEngineering.net
STOP
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
75
PROGRAM: ADDRESS
LABEL
8000
MNEMONICS
OPCODE
Initialize the memory pointer Move the First Data to A Reg Transfer Data To B Increment the memory pointer Get the second data from memory Multiply First and Second Data Initialize the memory pointer Store The Remainder Result Increment the data pointer Transfer B to A Store the Quotient result Stop the program
MOV DPTR,#9200 MOVX A,@DPTR MOV B,A INC DPTR MOVX A,@DPTR DIV AB
ww
w.E
MOV DPTR,#9500 MOVX @DPTR,A INC DPTR MOV B,A MOVX @DPTR,A SJMP : HLT
asy
HLT
Input:
Memory location
En
9200 9201
Output: Memory location 9500
gin
Data
Data
COMMENTS
eer
ing
.ne t
9501
Result: Thus the division of two numbers was performed using the 8085 microprocessor.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
76
EX.NO:22 DATE : PROGRAM FOR INTERFACING OF ADC WITH 8051 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: Sl. No
Name of the Apparatus
ww 1 2 3 4 5
Qty
8051 Microcontroller kit +5Volts Power Supply Keyboard Connector ADC Interfacing kit Multi-meter
1 1 1 1 1
w.E
asy
Working procedure for ADC:
En
Connect the 5v power supply to trainer kit and adc chord.
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. Vary the pot in the adc chord.
ing
.ne 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.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
77
8085 ADDRESS: 8255 control register address – 6003H 8255 port A address
-6000H
8255 port B address
-6001 H
8255 port C address
-6002H
ww
w.E
asy
En
VVIT
-
Visit : www.EasyEngineering.net
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
78
PROGRAM: ADDRESS
LABEL
9000
MNEMONICS
OPCODE
Control Word for port A as input and port c as output
MOV DPRT,#6003
ww
w.E
MOV A,#90 MOVX @DPTR,A MOV DPTR,#6002 MOV A,#FF MOVX @DPTR,A MOV DPRT,#6002 MOV A,#00 MOVX @DPTR,A MOV DPTR,#6002 MOV A,#FF MOVX @DPTR,A LCALL DELAY MOV DPTR,#6000 MOV A,#FF MOVX @DPTR,A LCALL 00BB MOV R1,#FF NOP NOP DJNZ R1,LOOP RET
asy
En
DELAY LOOP
Analog Input
SOC(start of conversion)
gin
Digital output
COMMENTS
eer
ing
.ne t
Return to main Program
RESULT: Thus the conversion of a analog signal into and digital signal was executed using interfacing of ADC with 8051.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
79
EX.NO:23 DATE : PROGRAM FOR INTERFACING OF DAC WITH 8051 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: Sl.No 1 2 3 4 5
Name of the Apparatus 8051 Microcontroller kit +5Volts Power Supply Keyboard Connector DAC Interfacing kit CRO
ww
w.E
asy
Qty 1 1 1 1 1
Working procedure for DAC: Connect the 5v power supply to trainer kit and dac(0800) chord.
En
Connect the 26-pin connector from the kit to dac(0800) chord.
Connect the card from keyboard into the socket provided in the kit.
Switch on the power supply.
Assemble your program.
Give the digital data in the software program itself.
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.
gin
eer
ing
i)SQUARE WAVE FORM
.ne t
ALGORITHM: 1. Load the initial value (00) to Accumulator and move it to DAC. 2. Call the delay program 3. Load the final value (FF) to accumulator and move it to DAC. 4. Call the delay program. 5. Repeat steps 2 to 5. 6. Execute the program and using a CRO, verify that the waveform at the DAC2 output is a square-wave. Modify the frequency of the square-wave, by varying the time delay. VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
80
8085 ADDRESS: 8255 control register address – 6003H 8255 port A address
-6000H
8255 port B address
-6001 H
8255 port C address
-6002H
ww
w.E
asy
En
VVIT
-
Visit : www.EasyEngineering.net
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
81
PROGRAM: SQUARE WAVE FORM
ADDRESS
LABEL
8000
LOOP1
ww
MNEMONICS
OPCODE
COMMENTS
MOV P1,#00
Low Input
LCALL DELAY
Call Delay
MOV P1,#99
High Input
LCALL DELAY
Call Delay
SJMP START
Jump To Start
DELAY
MOV R0,#FF
RPT
DJNZ R0,RPT Return to main Program
RET
w.E
asy
En
V
gin time
VVIT
-
Visit : www.EasyEngineering.net
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
82
II) SAW TOOTH GENERATION: 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. 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.
ww
PROGRAM: SAW TOOTH WAVE FORM
w.E
ADDRESS LABEL 9000
LOOP
MNEMONICS
asy
COMMENTS
MOV P1,R1
En
LCALL DELAY INC R1 SJMP LOOP
DELAY MOV R0,#FF RPT
OPCODE
DJNZ,R0,RPT
gin
eer
RET
V
ing
.ne t
time
RESULT : Thus the conversion of a digital signal into an analog signal was executed using interfacing of DAC with 8051.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
EX.NO:24 DATE
83
:
PROGRAM FOR INTERFACING STEPPER MOTOR USING 8051 MICROCONTROLLER AIM: To interface a stepper motor with 8051 microcontroller and operate it.
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 the next. Stepper Motors are used very wisely in position control systems like printers, disk drives, process control machine tools, etc. 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 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 run the motor in clockwise direction. By reversing the phase sequence as A1, B2, A2, B1, anticlockwise stepping can be obtained.
ww
w.E
asy
En
gin
eer
2-PHASE SWITCHING SCHEME: 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.
A1
A2
B1
B2
HEX
1 0
0 1
0 0
1 1
09 05
0
1
1
0
06
1
0
1
0
0A
ing
CLOCK WISE
.ne t
ANTI CLOCKWISE
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. VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
84
PROGRAM: ADDRESS 8000
LABEL
MNEMONICS
OPCODE
START
MOV DPTR,#TABLE MOV R0,#04 MOVX A,@DPTR LOOP1 PUSH DPH PUSH DPL MOV DPTR,#0FFCO MOVX @DPTR,A MOV R4,#0FF MOV R5,#0FF D1 DJNZ R5,D2 D2 DJNZ R4,D1 POP DPL POP DPH INC DPTR SJMP : START LOOKUP 09,06,05,0A
Initialize the memory pointer Load the counter Move the First Data to A Reg Transfer DPH to SP Transfer DPL to SP Initialize the port address
ww
w.E
asy
En
COMMENTS
Send the value to port address Delay subroutine
gin
eer
Next data Stop the program Data’s
ing
.ne t
RESULT: Thus a stepper motor was interfaced with 8051 and run in forward and reverse directions at various speeds.
VVIT
-
Visit : www.EasyEngineering.net
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING
EE6612 MICROPROCESSOR AND MICROCONTROLLER LABORATORY
85
ww
w.E
asy
En
VVIT
-
Visit : www.EasyEngineering.net
gin
eer
ing
.ne t
DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING