Professional Documents
Culture Documents
Laboratory Manual
MICROPROCESSOR AND
PERIPHERALS
For
TE (ECT)
Amruta Fawade
It is my great pleasure to present this laboratory manual for third year Electronics
students for the subject of Microprocessor and peripherals (MPP).
Microprocessor is the brain of computer. It is a general purpose programmable logic
device. A thorough understanding of 8085Microprocessor concepts, demands Assembly
Language programming with in depth knowledge of instructions and clarity in analysis
of the task.
Most of the students find it difficult to start with the programming assignment.
Therefore, a structured approach to learn programming through steps like problem
statement, analysis, logic & flowchart, actual program(Mnemonics)and comments, is
illustrated with sample programs.
This lab manual introduces students to the elementary programming techniques,
interfacing and designing simple applications using peripheral chips like 8255, 8279,
8253etc.
Students are advised to thoroughly go through this manual rather than only topics
mentioned in the syllabus, as practical aspects are the key to understanding and
conceptual visualization of theoretical aspects covered in the books.
Good Luck for your Enjoyable Laboratory Sessions.
Author
2
Dept Of Electronics And Telecommunication
3
Dept Of Electronics And Telecommunication
4
Dept Of Electronics And Telecommunication
5
Dept Of Electronics And Telecommunication
Memory
Address
7000,01
7002,03
7005
Opcode/data/
address
3E,11
06,12
80
7006
CF
Data:
Result:
label
Mnemonics
Comments
MVI A ,11 H
MVI B,12 H
ADD B
RST1
Conclusion: Thus, the program written for addition of two 8 bit numbers is successfully executed.
6
Dept Of Electronics And Telecommunication
Memory
Address
7000,01
7002,03
7005
Opcode/data/ad label
dr
3E,05
06,02
90
Mnemonics
Comments
MVI A ,05 H
MVI B,02 H
SUB B
7006
CF
RST1
Data:
Result:
Conclusion: Thus program written for Subtraction of two 8 bit numbers is successfully executed.
7
Dept Of Electronics And Telecommunication
Memory
Address
2000
Opcode/data/addr label
Mnemonics
Comments
2A,01,25
LHLD 2501
2003
EB
XCHG
2004
2A,03,25
LHLD 2503
2007
0E,00
MVI C,00
2009
19
DAD D
200A
D2,0E,20
JNC AHEAD
200D
200E
0C
22,05,25
2011
79
MOV A,C
2012
32,07,25
STA 2507
2015
CF
RST1
INR C
AHEAD SHLD 2505
Conclusion: Thus program written for addition of two 16 bit numbers is successfully executed.
8
Dept Of Electronics And Telecommunication
Memory
Address
7000
Opcode/data/addr label
Mnemonics
Comments
2A,01,25
7003
EB
LHLD
2501H
XCHG
7004
2A,03,25
7007
7B
LHLD
2503H
MOV A,E
7008
95
SUB L
7009
700A
6F
7A
MOV L,A
MOV A,D
700B
9C
SBB H
7000C
700D
67
22,05,25
MOV H,A
SHLD 2505
7010
CF
RST1
Data:
2501H = 19H
2502H = 6AH
2503H = 15H
2504H = 5CH
9
Dept Of Electronics And Telecommunication
Memory
Address
7000
Opcode/data/addr label
Mnemonics
Comments
79
MOV A,C
7001
7002
7003
83
27
6F
ADD E
DAA
MOV L,A
7004
78
MOV A,B
7005
7006
7007
8A
27
67
ADC D
DAA
MOV H,A
7008
CF
RST1
10
Dept Of Electronics And Telecommunication
Statement: 5 no. of bytes is stored from the memory locations 2201h. Transfer the entire block of
data bytes from 2201H to 2301H onwards.
Algorithm (Logic):1.Initialize the source memory pointer.
2. Initialize the destination memory pointer.
3. Initialize the counter with 5.
4. Move the contents of the source memory to accumulator.
5. Do whatever manipulation is specified /required.
6. Transfer the accumulator contents to destination memory location.
7. Increment source, destination memory pointer and decrement the counter.
8. If the count is not zero, jump back to step 4.
9. If the count is zero, stop.
Sample:
N=5 bytes, source location: 2201 to 2205, destination location: 2301 to 2305.
Data Transfer:
Memory
Address
7000,01,02
Opcode/data/ad label
dr
21,01,22
Mnemonics
Comments
LXI H,2201H
7003,04,05
01,01,23
LXI B,2301H
7006,07
7008
16,05
7E
7009
02
STAX B
700A
700B
700C
700D,0E,0F
23
03
15
C2,08,70
INX H
INX B
DCRD
JNZ LOOP
7010
CF
RST1
Data:
Result:
LOOP
MVI D,05H
MOV A,M
11
Dept Of Electronics And Telecommunication
Memory
Address
6000
Opcode/data/addr label
Mnemonics
Comments
21 ,00,25
6003
6004
4E
23
LXI
H,2500H
MOV C,M
INX H
6005
7E
MOV A,M
6006
6007
6008
0D
23
BE
6009
D2,0D,60
600C
7E
600D
600E
6011
6014
0D
C2,07,60
32,50,24
CF
LOOP
DCR C
INX H
CMP M
JNC
AHEAD
MOV A,M
AHEAD
DCR C
JNZ LOOP
STA 2450
RST1
Store result
Stop.
Data:
2500-03
2501-98
2502-75
2503-99
Result:
2450-99
Conclusion: thus we have studied the program for finding largest number.
12
Dept Of Electronics And Telecommunication
Memory
Address
2000
Opcode/data/addr label
Mnemonics
Comments
21 ,00,25
2003
2004
4E
23
LXI
H,2500H
MOV C,M
INX H
2005
7E
MOV A,M
2006
2007
0D
23
2008
BE
CMP M
2009
DA, OD,20
JC AHEAD
200C
7E
MOV A,M
200D
200E
2011
2014
0D
C2,07,20
32,50,24
CF
1st number in
accumulator.
Decrement count
Address of next number
.in HL pair
Compare next number
with previous minimum
number .if next
number>previous
minimum?
Yes ,smaller number is in
accumulator go to ahead
No . get larger number in
accumulator
Decrement count
Data:
Result:
LOOP
DCR C
INX H
AHEAD DCR C
JNZ LOOP
STA 2450
RST1
Store result
Stop.
2500-03
2501-86
2502-58
2503-75
2450-58
Conclusion: Thus we have studied the program for finding smallest number.
13
Dept Of Electronics And Telecommunication
Memory
Address
7000,01,02
Opcode/data/ad
dr
21,00,22
label
7003
7004,05
7006
7007
4E
3E,00
23
86
7008
7009
700A,0B,0C
23
0D
C2,07,70
INXH
DCR C
JNZ LOOP
700D,OE,OF
7010
32,01,23
CF
STA 2301
RST1
LOOP
Mnemonics
Comments
LXI H,2200H
MOV C,M
MVI A,00H
INX H
ADD M
Data:
Result:
Conclusion: Thus, the program written for addition has been successfully executed.
14
Dept Of Electronics And Telecommunication
Memory
Address
7000,01,02
Opcode/data/ad label
dr
21,00,22
Mnemonics
Comments
LXI H,2200H
7003
7004,05
7006,07
4E
3E,00
16,00
MOV C,M
MVI A,00H
MVI D,00H
7008
7009
23
86
INX H
ADD M
700A,0B, 0C
700D
700E
700F
7010,11, 12
DA, 0D ,70
14
23
0D
C2,09,70
7013,14, 15
7016
7017,18, 19
701A
32,01,23
7A
32,02,23
CF
LOOP
CLEAR
JNC CLEAR
INR D
INXH
DCR C
JNZ LOOP
STA 2301H
MOV A, D
STA 2302H
RST1
15
Dept Of Electronics And Telecommunication
Memory
Address
7000,01,02
7003
7004,05,06
Opcode/
data/add
r
3A,00,22
47
21,01,22
Label
Mnemonics
Comments
LOOP2
LDA 2200H
MOV B, A
LXI H, 2201H
LOOP1
MOV C, B
MOV A, M
7007
7008
48
7E
7009
700A
700B,0C,0D
23
BE
DA,13,70
INX H
CMP M
JC DOWN
700E
700F
56
77
MOV D,M
MOV M,A
7010
7011
2B
72
DCX H
MOVM,D
7012
23
INX H
7013
7014,15,16
7017
7018,19,1A
701B
0D
C2,08,70
05
C2,04,70
CF
DOWN
DCR C
JNZ LOOP1
DCR B
JNZ LOOP2
RST1
Conclusion: Thus, program written for arranging numbers in ascending order is successfully executed.
16
Dept Of Electronics And Telecommunication
To write Assembly Language Program (ALP) for sorting the series in Descending
order.
Statement: N no. of bytes are stored from the memory locations 2201h.(N can be mentioned
directly or given in a location (2200H) .Sort the series in Descending order.
Algorithm(Logic): 1.Initialize the source memory pointer.
2.Initialize two counters: one to compare the data and another to repeat the
process of comparison till all the nos. are over.
3.The first and the next no. are compared .Larger of the two is retained in the
first memory location. The smaller of the two is moved to the next memory
location.
4.Decrement the count.
5 The second memory location is compared with the third and again step 3 is
repeated till the count is zero.
6.At the end ,the smallest no. will be at the last location.
Data:
N no. of bytes stored from 2201 onwards.
Result:
Numbers stored from 2201 are arranged in descending order.
Sample:
N=(2200), source location: 2201 to 2205,destination location: 2201 to 2205.
Memory
Address
7000,01,02
7003
7004,05,06
Opcode/
data/add
r
3A,00,22
47
21,01,22
Label
Mnemonics
Comments
LOOP2
LDA 2200H
MOV B,A
LXI H,2201H
LOOP1
MOV C,B
MOV A,M
7007
7008
48
7E
7009
700A
700B,0C,0D
23
BE
D2,13,70
INX H
CMP M
JNC DOWN
700E
700F
56
77
MOV D,M
MOV M,A
7010
7011
2B
72
DCX H
MOVM,D
7012
23
INX H
7013
7014,15,16
7017
7018,19,1A
701B
0D
C2,08,70
05
C2,04,70
CF
DOWN
DCR C
JNZ LOOP1
DCR B
JNZ LOOP2
RST1
Conclusion: Thus, program written for arranging numbers in descending order is successfully executed.
17
Dept Of Electronics And Telecommunication
Memory
Address
7000,01
7002,03
7004,05
7006
Opcode/data/
address
3E,00
06,04
0E,03
80
label
Mnemonics
Comments
UP:
MVI A ,00 H
MVI B,o4 H
MVI C,o3 H
ADD B
7007
0D
7008, 09, 0A C2, 06, 70
DCR C
JNZ UP
STA 2600
700E
RST1
Data:
Result:
CF
18
Dept Of Electronics And Telecommunication
Memory
Address
7000,01,02
7003,04,05
Opcode/da
ta/addr
31,FF,23
21,00,22
Label
7006,07,08
01,00,23
LOOP2
LXI B ,2300H
7009
700A,0B,0C
700D
7E
CD,00,71
02
LOOP1
MOV A,M
CALL 7100H
STAX B
700E
CF
RST1
SUBROUTINE:
7100
7101
7102
7103,04
7105
C5
D5
57
E6,0F
4F
PUSH B
PUSH D
MOV D,A
ANI 0F H
MOV C,A
7106
7107,08
7109
710A
710B
710C
78
E6,F0
0F
0F
0F
0F
MOV A,D
ANI F0 H
RRC
RRC
RRC
RRC
710D
710E
710F,10
7111
57
AF
1E,OA
83
MOV D,A
XRA A
MVI E,OA H
ADD E
DOWN
SUM
Mnemonics
Comments
LXI SP,23FF
LXI H ,2200H
19
Dept Of Electronics And Telecommunication
15
C2,11,71
81
D1
DCR D
JNZ SUM
ADD C
POP D
7118
C1
POP B
7119
C9
RET
20
Dept Of Electronics And Telecommunication
Logic:
CHECK:
Initialize 8255 with port A as i/p port, port B as output port and port Clower as
input port.
Out this control word to control word register.
Select the channel for taking analog data.
Make the SOC(Start of conversion ) and ALE (Address Latch Enable) High.
Make SOC low.
Check EOC connected to port C of 8255 for high.
If no, Jump to CHECK.
If yes, clear the contents of accumulator.
Read the digital data available on Port A from the ADC.
Display it in the data field.
Theory:
ALP:
Conclusion:
21
Dept Of Electronics And Telecommunication
Logic:
Theory:
Conclusion: Square wave generated, observed on CRO, proves the program for DAC I/F is correct.
22
Dept Of Electronics And Telecommunication
Port A
01H
09H
Port B
02H
0AH
Port C
Control Register
03H
0BH
Control Word:
BSR/IO modeA PA PCu ModeB PB PCl
1
0 0 0 *
*
* * =80H
Write a program according to the logic of the program.
Theory: Explain working of a relay and the interfacing circuit.
Explain in detail the interfacing of relay with 8085
Result: Relay turns ON-OFF.
23
Dept Of Electronics And Telecommunication
Port A
01H
09H
Port B
02H
0AH
Port C
03H
0BH
Control Register
Control Word:
BSR/IO modeA PA PCu ModeB PB PCl
1
0 0 0 *
*
* * =80H
Write a program according to the logic of the program.
Theory: Explain working of LED interfacing circuit.
Explain in detail the interfacing of LED with 8085
Result: Calculate the Delay .Generate a delay of 0.5 sec.
24
Dept Of Electronics And Telecommunication
Conclusion:
Stepper motor rotating clockwise and anticlockwise proves the program for I/F is
correct.
25
Dept Of Electronics And Telecommunication
26
Dept Of Electronics And Telecommunication
27
Dept Of Electronics And Telecommunication
28
Dept Of Electronics And Telecommunication