Microprocessor Lab Manual
Microprocessor Lab Manual
ON
MICROPROCESSOR 8085
This 8085 microprocessor lab manual is designed to provide a basic knowledge about
8085 microprocessor to the users and the students. Before reading this manual, the students
must be familiar with the basics of 8085 and should be capable of performing basic logical
programming on paper. The programs in the manual are in assembly language which in itself
requires rigorous mental exercise. To perform to the fullest, the students must attend this lab
course in parallel to the theory course.
The authors of this manual went through plenty of books and sources to gather a list
of programs and experiments that test the students programming capabilities while preparing
them to operate the 8085 kit without any hassle. The programs are preceded by some theory
that captures the gist of the topic. For best results, the authors recommend using ______
along with the 8085 kit provided in the lab.
It is of utmost importance that the contents of this manual are error free and the
authors have tried their best to make it so. If you come across any misprint or misinformation,
kindly inform your lab in-charge.
Contents
EXPERIMENT 1.......................................................................................................................2
AIM....................................................................................................................................................2
ARCHITECTURE OF 8085 MICROPROCESSOR.....................................................................................2
PIN DESCRIPTION...............................................................................................................................4
SPECIFICATIONS.................................................................................................................................6
EXPERIMENT 02.....................................................................................................................7
AIM....................................................................................................................................................7
PREREQUISITES..................................................................................................................................7
APPARATUS REQUIRED......................................................................................................................7
ALGORITHM.......................................................................................................................................7
FLOWCHART......................................................................................................................................8
SOURCE CODE...................................................................................................................................9
SAMPLE INPUT-OUTPUT..................................................................................................................10
QUESTIONS:.....................................................................................................................................10
EXPERIMENT 03...................................................................................................................11
AIM..................................................................................................................................................11
PREREQUISITES................................................................................................................................11
APPARATUS REQUIRED....................................................................................................................11
ALGORITHM.....................................................................................................................................11
FLOWCHART....................................................................................................................................12
SOURCE CODE.................................................................................................................................13
SAMPLE INPUT OUTPUT..................................................................................................................14
QUESTIONS:.....................................................................................................................................14
EXPERIMENT 04(a)...............................................................................................................15
AIM..................................................................................................................................................15
PREREQUISITES................................................................................................................................15
APPARATUS REQUIRED....................................................................................................................15
ALGORITHM.....................................................................................................................................15
FLOWCHART....................................................................................................................................16
SOURCE CODE.................................................................................................................................17
SAMPLE INPUT OUTPUT..................................................................................................................18
QUESTIONS......................................................................................................................................18
EXPERIMENT 04(b)...............................................................................................................19
AIM:.................................................................................................................................................19
PREREQUISITES:...............................................................................................................................19
APPARATUS REQUIRED:...................................................................................................................19
ALGORITHM:....................................................................................................................................19
FLOWCHART:...................................................................................................................................20
SOURCE CODE.................................................................................................................................20
SAMPLE INPUT OUTPUT..................................................................................................................21
QUESTIONS......................................................................................................................................21
EXPERIMENT 05(a)...............................................................................................................22
AIM..................................................................................................................................................22
PREREQUISITES................................................................................................................................22
APPARATUS REQUIRED....................................................................................................................22
ALGORITHM.....................................................................................................................................22
FLOWCHART....................................................................................................................................23
SOURCE CODE.................................................................................................................................24
SAMPLE INPUT AND OUTPUT..........................................................................................................25
QUESTIONS......................................................................................................................................25
EXPERIMENT 05(b)...............................................................................................................26
AIM..................................................................................................................................................26
PREREQUISITES................................................................................................................................26
APPARATUS REQUIRED....................................................................................................................26
ALGORITHM.....................................................................................................................................26
FLOWCHART....................................................................................................................................27
SOURCE CODE.................................................................................................................................28
SAMPLE INPUT OUTPUT..................................................................................................................28
QUESTIONS......................................................................................................................................28
EXPERIMENT 06...................................................................................................................29
AIM..................................................................................................................................................29
PREREQUISITES................................................................................................................................29
APPARATUS REQUIRED....................................................................................................................29
ALGORITHM.....................................................................................................................................29
FLOWCHART....................................................................................................................................30
SOURCE CODE.................................................................................................................................31
SAMPLE INPUT OUTPUT..................................................................................................................32
QUESTIONS......................................................................................................................................32
EXPERIMENT 07...................................................................................................................33
AIM..................................................................................................................................................33
PREREQUISITES................................................................................................................................33
APPARATUS REQUIRED....................................................................................................................33
ALGORITHM.....................................................................................................................................33
FLOWCHART....................................................................................................................................33
SOURCE CODE.................................................................................................................................34
SAMPLE INPUT OUTPUT..................................................................................................................34
QUESTIONS......................................................................................................................................35
EXPERIMENT 08...................................................................................................................36
AIM..................................................................................................................................................36
PREREQUISITES................................................................................................................................36
APPARATUS REQUIRED....................................................................................................................36
ALGORITHM.....................................................................................................................................36
FLOWCHART....................................................................................................................................37
SOURCE CODE.................................................................................................................................38
SAMPLE INPUT AND OUTPUT..........................................................................................................39
QUESTIONS......................................................................................................................................39
EXPERIMENT 09...................................................................................................................40
AIM..................................................................................................................................................40
PREREQUISITES................................................................................................................................40
APPARATUS REQUIRED.....................................................................................................40
ALGORITHM.....................................................................................................................................40
FLOWCHART....................................................................................................................................40
SOURCE CODE.................................................................................................................................41
SAMPLE INPUT AND OUTPUT..........................................................................................................41
QUESTIONS......................................................................................................................................41
EXPERIMENT 10...................................................................................................................42
AIM..................................................................................................................................................42
PREREQUISITES................................................................................................................................42
APPARATUS REQUIRED....................................................................................................................42
ALGORITHM.....................................................................................................................................42
FLOWCHART....................................................................................................................................43
SOUCE CODE....................................................................................................................................44
SAMPLE INPUT AND OUTPUT..........................................................................................................45
QUESTIONS......................................................................................................................................45
EXPERIMENT 11...................................................................................................................46
AIM..................................................................................................................................................46
PREREQUISITES................................................................................................................................46
APPARATUS REQUIRED....................................................................................................................46
ALGORITHM.....................................................................................................................................46
FLOWCHART....................................................................................................................................47
SOURCE CODE.................................................................................................................................48
SAMPLE INPUT AND OUTPUT..........................................................................................................49
QUESTIONS......................................................................................................................................49
EXPERIMENT 12...................................................................................................................50
AIM..................................................................................................................................................50
PREREQUISITES................................................................................................................................50
APPARATUS REQUIRED....................................................................................................................50
ALGORITHM.....................................................................................................................................50
FLOWCHART....................................................................................................................................51
SOURCE CODE.................................................................................................................................52
SAMPLE INPUT AND OUTPUT..........................................................................................................52
QUESTIONS......................................................................................................................................52
APPENDIX I............................................................................................................................53
EXPERIMENT 1
They are six 8 bit register i.e. B, C, D, E, H, L. The combination of 8 bit register is
known as register pair, which can hold 16 bit data. The HL pair is used to act as memory
pointer is accessible to program.
b) Accumulator
It is an 8 bit register which hold one of the data to be processed by ALU and store`d
the result of the operation.
It carries out arithmetic and logical operation by 8 bit address it uses the accumulator
content as input the ALU result is stored back into accumulator.
f) Temporary register
It is an 8 bit register associated with ALU hold data, entering an operation, used by
the microprocessor and not accessible to programs.
g) Flags
Flag register is a group of flip-flops which are set or reset after an operation according
to the data conditions of the result in the accumulator. The five flags are
i) Carry flag (C)
ii) Parity flag (P)
iii) Zero flag (Z)
iv) Auxiliary carry flag (AC)
v) Sign flag (S)
h) Timing and control unit
All microprocessor operation with the clock and generator and control signal from it
necessary to maintain a synchronous communication between controller and peripheral.
i) Instruction register and decoder
Instruction is fetched from line memory and stored in line instruction register decoder
the stored information.
j) Register Array
These are used to store 8 bit data during execution of some instruction.
Address Bus
1. The signal goes high during the first clock cycle and enables the lower order address
bits.
IO / M
1. This distinguishes whether the address is for memory or input.
2. When this pin goes high, the address is for an I/O device.
S0 – S1
S0 and S1 are status signal which provides different status and functions.
RD
1. This is an active low signal
2. This signal is used to control READ operation of the microprocessor.
WR
1. WR is also an active low signal
2. Controls the write operation of the microprocessor.
HOLD
1. This indicates if any other device is requesting the use of address and data bus.
HLDA
1. HLDA is the acknowledgement signal for HOLD
2. It indicates whether the hold signal is received or not.
INTR
1. INTE is an interrupt request signal
2. IT can be enabled or disabled by using software
INTA
1. Whenever the microprocessor receives interrupt signal
2. It has to be acknowledged.
TRAP
1. Trap is the only non-maskable interrupt
2. It cannot be enabled (or) disabled using program.
RESET IN
1. This pin resets the program counter to 0 to 1 and results interrupt enable and HLDA
flip flops.
X1, X2
These are the terminals which are connected to external oscillator to produce the
necessary and suitable clock operation.
SID
This pin provides serial input data
SOD
This pin provides serial output data
1. Processors
Intel 8085 at E144 MHz clock
2. Memory
Monitor RAM: 0000– IFFF
EPROM Expansion: 2000– 3FFF’s
0000– FFF
System RAM: 4000– 5FFF
Monitor data area 4100– 5FFF
RAM Expansion 6000– BFFF
3. Input / Output
Parallel: A8 TTL input timer with 2 number of 32-55 only input timer available in -
85 EBI.
Serial: Only one number RS 232-C, Compatible, crucial interface using 8281A
4. Timer: 3 channel -16 bit programmable units, using 8253 channel ‘0’ used for no band
late. Clock generator. Channel ‘1’ is used for single stopping used program.
5. Display: 6 digit – 7 segment LED display with filter 4 digit for adder display and 2 digit
for data display.
6. Key board: 21 keys, soft keyboard including common keys and hexa decimal keys.
7. RES: Reset keys allow to terminate any present activity and retain to - 85 its on initialize
state.
10. EXEC: Execute line particular value after selecting address through go command.
11. NEXT: Increment the address by 1 and then display its content.
EXPERIMENT 02
APPARATUS REQUIRED
ALGORITHM
4102 LDA 4300 3A,(00,43) Load the first 8 bit data from the memory address
4300H
4105 MOV B,A 47 Copy the value of 8 bit data into register B from
accumulator
4106 LDA 4301 3A (01,43) Load the second 8 bit data from the memory address
4300H
410E LOOP STA 4302 32 (02,43) Store the added value at the address 4302H
4111 MOV A,C 79 Copy the value of carry to the accumulator from
register C
4112 STA 4303 32 (03,43) Store the value of carry at the address 4303 from
accumulator
a. Without carry
Input Address Value
4300 08
4301 03
b. With carry
4300 4F
4301 FF
4302 4E
4303 01 (carry)
QUESTIONS:
MVI A, 45H
MVI B, 25H
ADD B
HLT
EXPERIMENT 03
APPARATUS REQUIRED
ALGORITHM
Start
No
Check if
borrow?
Yes
C=C+1
End
18
SOURCE CODE
4102 LDA 4300 3A,(00,43) Load the first 8 bit data from the memory address
4300H
4105 MOV B,A 47 Copy the value of 8 bit data into register B from
accumulator
4106 LDA 4301 3A (01,43) Load the second 8 bit data from the memory address
4300H
410E LOOP STA 4302 32 (02,43) Store the added value at the address 4302H
4111 MOV A,C 79 Copy the value of borrow to the accumulator from
register C
4112 STA 4303 32 (03,43) Store the value of borrow at the address 4303 from
accumulator
19
SAMPLE INPUT OUTPUT
a. Without borrow
Input Address Value
4300 08
4301 03
b. With borrow
4300 4F
4301 FF
4302 B0
4303 01 (borrow)
QUESTIONS:
20
EXPERIMENT 04(A)
APPARATUS REQUIRED
ALGORITHM
21
FLOWCHART
22
SOURCE CODE
4104 LDA 4501 3A 01,45 Load the 2nd number bit data
4107 MOV C,A 4F Move the 2nd bit data to register C (Counter)
4115 STA 4502H 32 (02,45) Store the result at the address 4502H
4119 STA 4503 32 (03,45) Store the value of carry at the address 4503
from accumulator
23
SAMPLE INPUT OUTPUT
QUESTIONS
24
EXPERIMENT 04(B)
APPARATUS REQUIRED:
ALGORITHM:
25
FLOWCHART:
SOURCE CODE
26
200A 04
QUESTIONS
27
EXPERIMENT 05(A)
APPARATUS REQUIRED
ALGORITHM
1. Start the program by loading the HL pair registers with address of memory location.
2. Move the data to register B.
3. Load the 2nd data into accumulator.
4. Compare the two numbers to check the carry
5. Subtract the two numbers.
6. Increment the value of carry.
7. Check whether repeated subtraction is over.
8. Store the results in given memory location
9. Terminate the program.
28
FLOWCHART
29
SOURCE CODE
30
SAMPLE INPUT AND OUTPUT
Input Address Contents
2050 FF
2051 FE
Input Address Contents
3050 01
3051 01
QUESTIONS
31
EXPERIMENT 05(B)
APPARATUS REQUIRED
ALGORITHM
32
FLOWCHART
33
SOURCE CODE
QUESTIONS
34
EXPERIMENT 06
APPARATUS REQUIRED
ALGORITHM
35
FLOWCHART
Start
A=A+B
NO
Is carry
set?
YES
End
36
SOURCE CODE
4013 NEXT STA 2053H 32 5320 Store content of accumulator into memory
37
SAMPLE INPUT OUTPUT
Input Address Contents
2050 42
2051 28
QUESTIONS
38
EXPERIMENT 07
APPARATUS REQUIRED
ALGORITHM
FLOWCHART
Start
End
39
SOURCE CODE
4000 LHLD 2000 2A 00 20 Load first 16 bit from 2000H and 2001H to HL
register pair
4004 LHLD 2002 2A 02 20 Load first 16 bit from 2002H and 2003H to HL
register pair
40
QUESTIONS
41
EXPERIMENT 08
APPARATUS REQUIRED
ALGORITHM
42
FLOWCHART Start
C = Block Size
C=C-1
HL = HL + 1
A>B No
Yes
B =A
C=C-1
No
Z
C == 0?
0?
Yes
Store the maximum from B into memory
End
43
SOURCE CODE
44
SAMPLE INPUT AND OUTPUT
Input:
Address Data
8000 06
8001 44
8002 22
8003 4F
8004 1F
8005 20
8006 32
Output:
Address Data
9000 4F
QUESTIONS
Address Data
3000 6
3001 23
3002 12
3003 5F
3004 10
3005 1A
3006 20
45
EXPERIMENT 09
APPARATUS REQUIRED
ALGORITHM
FLOWCHART
Start
A = (A)AND(01)
A =0?
Yes No
EVEN ODD
End 46
SOURCE CODE
Input:
Address Data
2050 0A
Output:
Address Data
2051 22
QUESTIONS
47
EXPERIMENT 10
APPARATUS REQUIRED
ALGORITHM
48
FLOWCHART
Start
RAR
Is CY = No
1?
Yes
D=D+1
C=C-1
No Is
counter
zero ?
Yes
Store the count in memory
End
49
SOUCE CODE
50
SAMPLE INPUT AND OUTPUT
Input:
Address Data
3000 0A
Output:
Address Data
3001 02
QUESTIONS
51
EXPERIMENT 11
AIMProgram to pack two unpacked BCD numbers stored in memory locations 2000H and
2001H and store result in memory location 2300H. Assume the least significant digit is stored
at 2000H.
APPARATUS REQUIRED
ALGORITHM
52
FLOWCHART
Start
Stop
53
SOURCE CODE
54
SAMPLE INPUT AND OUTPUT
Input:
Address Data
2000 04
2001 05
Output:
Address Data
2300 54
QUESTIONS
55
EXPERIMENT 12
APPARATUS REQUIRED
ALGORITHM
56
FLOWCHART
Start
End
57
SOURCE CODE
Input:
Address Data
2050 74
Output:
Address Data
3050 4E
QUESTIONS
58
APPENDIX I
Opcode sheet for 8085 Microprocessor with description
59
INR REG 3C Increment register
INR M 3C Increment memory
INX B 03 Increment BC
INX D 13 Increment DE
INX H 23 Increment HL
INX SP 33 Increment Stack Point
JMP ADDR C3 Jump unconditional
JC ADDR DA Jump on carry
JM ADDR FA Jump on Minus
JNC ADDR D2 Jump on No carry
JNZ ADDR C2 Jump on non zero
JP ADDR F2 Jump on plus
JPE ADDR EA Jump on parity even
JPO ADDR E2 Jump on parity odd
JZ ADDR CA Jump on zero
LDA ADDR 3A Load Accumulator direct
LDAX B 0A Load Accumulator indirect
LDAX D 1A Load Accumulator indirect
LHLD ADDR 2A Load HL direct
LXI B, 16 bit 01 Load immediate BC
LXI D, 16 bit 11 Load immediate DE
LXI H, 16 bit 21 Load immediate HL
LXI SP, 16 bit 31 Load immediate Stack pointer
MOV R1,R2 7F Move register to register
MOV M,R 77 Move register to memory
MOV R,M 7E Move memory to register
MVI R, 3E Move immediate
MVI M,DATA 36 Move immediate to memory
NOP 00 No operation
ORA REG B7 Inclusive OR Accumulator
ORA M B6 Inclusive OR Accumulator
ORI DATA F6 Inclusive OR Immediate
OUT PORT D3 Output
PCHL E9 Jump HL indirect
POP B C1 Pop BC
POP D D1 Pop DE
POP H E1 Pop HL
POP PSW F1 Pop program status word
60
PUSH B C5 Push BC
PUSH D D5 Push DE
PUSH H E5 Push HL
PUSH PSW F5 Push program status word
RAL 17 Rotate accumulator left through carry
RAR 1F Rotate accumulator right through carry
RET C9 Return
RC D8 Return on carry
RIM 20 Read interrupt mask
RM F8 Return on minus
RNC D0 Return on No Carry
RNZ C0 Return on non zero
RP F0 Return on plus
RPE E8 Return on parity even
RPO E0 Return on parity odd
RZ C8 Return on zero
RLC 07 Rotate accumulator left
RRC 0F Rotate accumulator right
RST C7 Restart
SBB REG 9F Subtract with borrow
SBB M 9E Subtract with borrow
SBI DATA DE Subtract with borrow immediate
SHLD ADDR 22 Store HL pair direct
SIM 30 Set Interrupt mask
SPHL F9 Move HL to SP
STA ADDR 32 Store accumulator
STAX B 02 Store accumulator indirect in memory
address BC
STAX D 12 Store accumulator indirect in memory
address DE
STC 37 Set carry
SUB REG 97 Subtract register from accumulator
SUB M 96 Subtract memory from accumulator
SUI DATA D6 Subtract immediate data
XCHG EB Exchange HL with DE
XRA REG AF Exclusive OR register with accumulator
XRA M AE Exclusive OR memory with accumulator
XRI DATA EE Exclusive OR immediate data
XTHL E3 Exchange stack top with HL pair
61
62