Co Lab Manual New
Co Lab Manual New
1
KMEC COMPUTER ORGANIZATION LAB
PC451CS ANNEXURE-I
UNIVERSITY SYLLABUS
Course Objectives:
1. To become familiar with the architecture and Instruction set of Intel
8085 microprocessor.
2. To provide practical hands on experience with Assembly Language Programming.
3. To familiarize the students with interfacing of various peripheral devices with
8085 microprocessor.
List of Experiments
1. Tutorials on 8085 Programming.
7. Display interface.
2
KMEC COMPUTER ORGANIZATION LAB
8085 Programs
1. Introduction to 8085 4
2. 8 bit data Addition 7
3. 8 bit data Subtraction 9
4. 8 bit data Multiplication 12
5. 8 bit data Division 15
6. Largest Element in an array 18
7. Smallest Element in an array 21
8. Sorting in Ascending Order 24
9. Sorting in Descending Order 28
10. Code Conversions - Decimal to Hexadecimal 32
11. Code Conversions - Hexadecimal to Decimal 35
12. BCD Addition 38
13. BCD Subtraction 41
14. Introduction to 8255 PPI 44
15. Interfacing of Stepper Motor (clockwise & anti clockwise) 48
16. Interfacing of DAC 51
17. Interfacing of Traffic light controller 52
18. Interfacing of 8279 54
19. Display interface 55
3
KMEC COMPUTER ORGANIZATION LAB
INTEL 8085 is one of the most popular 8-bit microprocessor capable of addressing 64
KB of memory and its architecture is simple. The device has 40 pins, requires +5 V power
supply and can operate with 3MHz single phase clock.
4
KMEC COMPUTER ORGANIZATION LAB
Register array
The 8085 has six general purpose registers to store 8-bit data during program execution.
These registers are identified as B, C, D, E, H and L. they can be combined as BC, DE and
HL to perform 16-bit operation.
Accumulator
Accumulator is an 8-bit register that is part of the ALU. This register is used to store 8-bit
data and to perform arithmetic and logic operation. The result of an operation is stored in the
accumulator.
Program counter
The program counter is a 16-bit register used to point to the memory address of the next
instruction to be executed.
Stack pointer
It is a 16-bit register which points to the memory location in R/W memory, called the
Stack.
5
KMEC COMPUTER ORGANIZATION LAB
Communication lines
8085 microprocessor performs data transfer operations using three communication lines
called buses. They are address bus, data bus and control bus.
Address bus – it is a group of 16-bit lines generally identified as A 0 – A15. The
address bus is unidirectional i.e., the bits flow in one direction from
microprocessor to the peripheral devices. It is capable of addressing 2 16 memory
locations.
Data bus – it is a group of 8 lines used for data flow and it is bidirectional. The
data ranges from 00 – FF.
Control bus – it consist of various single lines that carry synchronizing signals.
The microprocessor uses such signals for timing purpose.
6
KMEC COMPUTER ORGANIZATION LAB
AIM:
ALGORITHM:
RESULT:
Thus the 8 bit numbers stored at 6500 & 6501 are added and the result stored at 6502
and 6503.
7
KMEC COMPUTER ORGANIZATION LAB
FLOW CHART:
START
[C]00H
[HL] 6500H
NO
[A] [M]
Is there a
Carry ? YES
[HL] [HL]+1
[C][C]+1
[A] [A] + [M]
[HL][HL]+1
[HL] [HL]+1
[M] [A]
[M][C]
7
STOP
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
OBSERVATION:
INPUT OUTPUT
6500 6502
6501 6503
8
KMEC COMPUTER ORGANIZATION LAB
AIM:
ALGORITHM:
RESULT:
Thus the 8 bit numbers stored at 6500 & 6501 are subtracted and the result stored at 6502
and 6503.
9
KMEC COMPUTER ORGANIZATION LAB
FLOW CHART:
START
[C]00H
[HL] 6500H
[A][M]
[HL][HL]+1
[A][A]-[M]
Is there a NO
Borrow ?
YES
Complement [A] Add 01H to [A]
[C][C]+1
[HL][HL]+1
[M] [A]
[HL] [HL]+1
[M][C]
STOP 10
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
OBSERVATION:
INPUT OUTPUT
6500 6502
6501 6503
11
KMEC COMPUTER ORGANIZATION LAB
AIM:
To multiply two 8 bit numbers stored at consecutive memory locations and store the
result in memory.
ALGORITHM:
RESULT:
Thus the 8-bit multiplication was done in 8085p using repeated addition method.
FLOW CHART:
START
[HL] 6500
BM
[HL] [HL]+1
A 00
12
KMEC COMPUTER ORGANIZATION LAB
C 00
Is there
any carry
YES
C C+1
B B-1
NO
IS B=0
YES
[HL][HL]+1
[M] [A]
[HL] [HL]+1
[M][C]
STOP
13
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
OBSERVATION:
INPUT OUTPUT
6500 6502
6501 6503
14
KMEC COMPUTER ORGANIZATION LAB
AIM:
ALGORITHM:
RESULT:
Thus an ALP was written for 8-bit division using repeated subtraction method and
executed using 8085 p kits
15
KMEC COMPUTER ORGANIZATION LAB
FLOWCHART:
START
B 00
[HL] 6500
A M
[HL] [HL]+1
M A-M
[B] [B] +1
NO
IS A<0
YES
A A+ M
[M] [A]
B B-1
[HL][HL]+1
[HL] [HL]+1
[M][B]
STOP
16
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
OBSERVATION:
17
KMEC COMPUTER ORGANIZATION LAB
AIM:
To find the largest element in an array.
ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content
(next element).
7. If the accumulator content is smaller, then move the memory
content (largest element) to the accumulator. Else continue.
8. Decrement the counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.
RESULT:
Thus the largest number in the given array is found out.
18
KMEC COMPUTER ORGANIZATION LAB
FLOW CHART:
START
[HL] [6500H]
[B] 04H
[A] [HL]
[HL [HL] + 1
NO IS
[A] < [HL]?
YES
[A] [HL]
[B] [B]-1
NO IS
[B] = 0?
YES
[6505] [A]
STOP
19
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
6500 6505
6501
6502
6503
6504
20
KMEC COMPUTER ORGANIZATION LAB
AIM:
To find the smallest element in an array.
ALGORITHM:
1. Place all the elements of an array in the consecutive memory locations.
2. Fetch the first element from the memory location and load it in the accumulator.
3. Initialize a counter (register) with the total number of elements in an array.
4. Decrement the counter by 1.
5. Increment the memory pointer to point to the next element.
6. Compare the accumulator content with the memory content
(next element).
7. If the accumulator content is smaller, then move the memory
content (largest element) to the accumulator. Else continue.
8. Decrement the counter by 1.
9. Repeat steps 5 to 8 until the counter reaches zero
10. Store the result (accumulator content) in the specified memory location.
RESULT:
Thus the smallest number in the given array is found out.
21
KMEC COMPUTER ORGANIZATION LAB
FLOW CHART:
START
[HL] [6500H]
[B] 04H
[A] [HL]
[HL [HL] + 1
YES IS
[A] < [HL]?
NO
[A] [HL]
[B] [B]-1
NO IS
[B] = 0?
YES
[6505] [A]
STOP
22
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
OBSERVATION:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
6500 6505
6501
6502
6503
6504
23
KMEC COMPUTER ORGANIZATION LAB
ALGORITHM:
RESULT:
Thus the ascending order program is executed and thus the numbers are arranged in
ascending order.
24
KMEC COMPUTER ORGANIZATION LAB
FLOWCHART: START
[B] 04H
[HL] [6500H]
[C] 04H
[A] [HL]
[HL [HL] + 1
IS
[A] < [HL]?
YES
[D] [HL]
NO
[HL] [A]
[HL] [HL] - 1
[HL] [D]
[HL] [HL] + 1
[C] [C] – 01 H
25
KMEC COMPUTER ORGANIZATION LAB
NO IS
[C] = 0?
YES
[B] [B]-1
NO IS
[B] = 0?
YES
STOP
26
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
OBSERVATION:
INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
6500 6500
6501 6501
6502 6502
6503 6503
6504 6504
27
KMEC COMPUTER ORGANIZATION LAB
AIM:
To sort the given number in the descending order using 8085 microprocessor.
ALGORITHM:
RESULT:
Thus the descending order program is executed and thus the numbers are arranged
in descending order.
28
KMEC COMPUTER ORGANIZATION LAB
FLOWCHART: START
[B] 04H
[HL] [6500H]
[C] 04H
[A] [HL]
[HL [HL] + 1
IS
NO [A] < [HL]?
YES
[D] [HL]
[HL] [A]
[HL] [HL] - 1
[HL] [D]
[HL] [HL] + 1
[C] [C] – 01 H
29
KMEC COMPUTER ORGANIZATION LAB
NO IS
[C] = 0?
YES
[B] [B]-1
IS
[B] = 0?
NO
YES
STOP
30
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
OBSERVATION:
INPUT OUTPUT
MEMORY DATA MEMORY DATA
LOCATION LOCATION
6500 6500
6501 6501
6502 6502
6503 6503
6504 6504
31
KMEC COMPUTER ORGANIZATION LAB
ALGORITHM:
RESULT:
32
KMEC COMPUTER ORGANIZATION LAB
FLOWCHART:
START
HL6500H
A00
B00H
BB+1
AA +1
NO Is
A=M?
YES
AB
6501A
Stop
33
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
RESULT:
INPUT OUTPUT
ADDRESS DATA ADDRESS DATA
6500 6501
34
KMEC COMPUTER ORGANIZATION LAB
ALGORITHM:
RESULT:
Thus an ALP program for conversion of hexadecimal to decimal was written and
executed.
35
KMEC COMPUTER ORGANIZATION LAB
START
FLOWCHART:
HL6500H
A00
B00H
C00H
B B+1
A A +1
Is there
carry?
C C+1
D A,A B,
Is
A=M?
NO
6501 A, A C
6502 AY
Stop
36
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
RESULT:
INPUT OUTPUT
ADDRESS DAT ADDRESS DATA
A
6500 6501
6502
37
KMEC COMPUTER ORGANIZATION LAB
ALGORITHM:
RESULT:
Thus the 8 bit BCD numbers stored at 6500 & 6501 are added and the result stored at 6502
& 6503.
38
KMEC COMPUTER ORGANIZATION LAB
FLOW CHART:
START
[C]00H
[HL] N
6500H
Is there aYES
[A] [M]
Carry ?
[HL] [HL]+1
[C][C]+1
[A] [A]+[M]
[HL][HL]+1
Decimal Adjust Accumulator
[M] [A]
[HL][HL]+1
[M] [C]
STOP
39
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
OBSERVATION:
INPUT OUTPUT
6500 6502
6501 6503
40
KMEC COMPUTER ORGANIZATION LAB
AIM:
ALGORITHM:
RESULT:
Thus the 8 bit BCD numbers stored at 6500 & 6501 are subtracted and the result stored
at 6502 & 6503.
41
KMEC COMPUTER ORGANIZATION LAB
FLOW CHART:
START
[D] 00H
HL B 6500
M
HL HL+ 1
CA M 99
[A][A]+[B] DAA
Is there a YES
Carry ?
NO
[D][D]+1
[HL][HL]+1
[4502] A
[4503] D
STOP
42
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
OBSERVATION:
INPUT OUTPUT
6500 6502
6501 6503
43
KMEC COMPUTER ORGANIZATION LAB
APPARATUS REQUIRED:
8085 p kit, 8255Interface board, DC regulated power supply, VXT parallel bus
I/O MODES:
Control Word:
44
KMEC COMPUTER ORGANIZATION LAB
PROGRAM:
ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS
6100 START: MVI A, 90 Initialize port A as Input
6101 and Port B as output.
6102 OUT C6 Send Mode Control
6103 Word
6104 IN C0 Read from Port A
6105
6106 OUT C2 Display the data in port
6107 B
6108 STA 6200 Store the data read from
6109 Port A in 6200
610A
610B HLT Stop the program.
MAIN PROGRAM:
45
KMEC COMPUTER ORGANIZATION LAB
Sub program:
ADDRESS OPCODES LABEL MNEMONICS OPERAND COMMENTS
605E JMP 6200 Go to 6200
605F
6060
46
KMEC COMPUTER ORGANIZATION LAB
Any lines of port c can be set or reset individually without affecting other lines using this
mode. Let us set PC0 and PC3 bits using this mode.
PROGRAM:
RESULT:
Thus 8255 is interfaced and its characteristics in mode0,mode1 and BSR mode
is studied.
47
KMEC COMPUTER ORGANIZATION LAB
Exp 15: INTERFACING STEPPER MOTOR
Aim: To rotate stepper motor in forward and reverse direction.
Apparatus required:
Stepper motor, 8085 microprocessor kit, (0-5V) power supply.
Algorithm:
Step 1: Load the ‘HL’ pair wit value from table
Step 2: Move it to ‘B’ register for setting the counter
Step 3: Move the memory value to accumulator and display it by control
word Step 4: Load ‘DE’ register pair with FFFF for starting delay subroutine
Step 5: Run the delay loop control D-register becomes zero.
Step 6: Increment ‘H’ address for next value from table
Step 7: Jump on no zero
Step 8: When B = 0, go to start and restart the program.
Flowchart:
48
KMEC COMPUTER ORGANIZATION LAB
6033 C9 RET
49
KMEC COMPUTER ORGANIZATION LAB
50
NGIT COMPUTER ORGANIZATION LAB
Apparatus required: 8085 Microprocessor trainer kit, DAC interface board, Regulated
Power supply, CRO.
Description: Seven segment display interface is connected over J2 of the trainer. When the
trainer kit in KEYBOARD or SERIAL mode the square, triangular, sawtooth and staircase can
be displayed on CRO.
51
NGIT COMPUTER ORGANIZATION LAB
Apparatus required:
8085 Microprocessor trainer kit, Traffic light interface board, Regulated Power supply.
Description: The traffic system moves from one state to next state. By changing the
delay between two signals one can change the speed of traffic.
52
NGIT COMPUTER ORGANIZATION LAB
53
NGIT COMPUTER ORGANIZATION LAB
Apparatus required:
8085 Microprocessor trainer kit, 8279 keyboard/display interface board, Regulated Power
supply.
Description: 8279 keyboard/display interface is connected over J2 of the trainer. When the
trainer kit in KEYBOARD or SERIAL mode the pressed key can be displayed on display unit.
54
NGIT COMPUTER ORGANIZATION LAB
Apparatus required: 8085 Microprocessor trainer kit, LED interface board, Regulated
Power supply.
Description: LED interface is connected over J2 of the trainer. When the trainer kit
in KEYBOARD or SERIAL mode it scans system key codes.
PROGRAM:
55