Microprocessor Lab Manual PDF
Microprocessor Lab Manual PDF
\
1
MT6411 - Microprocessor Laboratory
LIST OF EXEPRIMENTS
3 Addition of 2 - 16 numbers 17
5 8 bit Multiplication 21
6 8 bit Division 24
2
MT6411 - Microprocessor Laboratory
b) Accumulator
It is an 8 bit register which hold one of the data to be processed by ALU and stored
the result of the operation.
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 fire, individual flip flops line content of line flag register
will change after execution of arithmetic and logic operation. The line states flags are
i) Carry flag (C)
ii) Parity flag (P)
iii) Zero flag (Z)
iv) Auxiliary carry flag (AC)
v) Sign flag (S)
3
MT6411 - Microprocessor Laboratory
PIN Description
Address Bus
1. The pins Ao A15 denote the address bus.
2. They are used for most significant bit
IO / M
1. This distinguishes whether the address is for memory or input.
2. When this pins go 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.
4
MT6411 - Microprocessor Laboratory
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
Specifications
1. Processors
Intel 8085 at E144 MHz clock
2. Memory
Monitor RAM: 0000 IFFF
EPROM Expansion: 2000 3FFFs
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
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.
Display: 6 digit 7 segment LED display with filter 4 digit for adder display and 2 digit for
data display.
Key board: 21 keys, soft keyboard including common keys and hexa decimal keys.
RES: Reset keys allow to terminate any present activity and retain to - 85 its on initialize
state.
5
MT6411 - Microprocessor Laboratory
EXEC: Execute line particular value after selecting address through go command.
H
7 i) Hex key entry 7
F2 ii) Register key H
6
MT6411 - Microprocessor Laboratory
I i) Register key S
8 ii) Register key I
G0
i) Hex key D
ii) Compare 2 memory block
D
CMP
E i) Hex key E
ii) Insert by test into memory (RAM)
INS
i) Hex key F
F ii) Delete byte from memory RAM
DEL
7
MT6411 - Microprocessor Laboratory
Key Function
8
MT6411 - Microprocessor Laboratory
ICs Used
8085 - 8 bit p
8253 - programmable internal timer
8255 - programmable peripheral interface
8279 - programmable key boards / display interface
8251 - programmable communication interface
2764 - 8 KV VV EPROM
6264 - 8K STATIC PROM
7414 - Hex inverter
7432 - Quad 21/p OR GATE
7409 - Quad 21/p AND GATE
7400 - NAND Gate
7404 - Dual D-FF
74373 - Octal D Latch
74139 - Dual 2 to 4 line decoder
74138 - 3 to 8 line decoder
9
MT6411 - Microprocessor Laboratory
Result:
Thus 8085 microprocessor was studied successfully.
10
MT6411 - Microprocessor Laboratory
Apparatus required:
8085 micro processor kit
(0-5V) DC battery
Algorithm:
Step 1 : Start the microprocessor
Step 2 : Intialize the carry as Zero
Step 3 : Load the first 8 bit data into the accumulator
Step 4 : Copy the contents of accumulator into the register B
Step 5 : Load the second 8 bit data into the accumulator.
Step 6 : Add the 2 - 8 bit datas and check for carry.
Step 7 : Jump on if no carry
Step 8 : Increment carry if there is
Step 9 : Store the added request in accumulator
Step 10 : More the carry value to accumulator
Step 11 : Store the carry value in accumulator
Step 12 : Stop the program execution.
11
MT6411 - Microprocessor Laboratory
STAR
T
Increment carry by
one
Store the added value in accumulator
END
12
MT6411 - Microprocessor Laboratory
Input
Without carry
Input Address Value
4300 04
4301 02
Output
Output Address Value
4302 06
4303 00 (carry)
With carry
Input Address Value
4300 FF
4301 FF
Result:
The assembly language program for 8 bit addition of two numbers was executed
successfully by using 8085 micro processing kit.
13
MT6411 - Microprocessor Laboratory
Apparatus required:
8085 micro processor kit
(0-5V) DC battery
Algorithm:
Step 1 : Start the microprocessor
Step 2 : Intialize the carry as Zero
Step 3 : Load the first 8 bit data into the accumulator
Step 4 : Copy the contents of contents into the register B
Step 5 : Load the second 8 bit data into the accumulator.
Step 6 : Subtract the 2 8 bit datas and check for borrow.
Step 7 : Jump on if no borrow
Step 8 : Increment borrow if there is
Step 9 : 2s compliment of accumulator is found out
Step 10 : Store the result in the accumulator
Step 11 : More the borrow value from c to accumulator
Step 12 : Store the borrow value in the accumulator
Step 13 : Stop program execution
14
MT6411 - Microprocessor Laboratory
START
No
Check
for
carry? Yes
END
15
MT6411 - Microprocessor Laboratory
Input
Without borrow
Input Address Value
4300 05
4301 07
Output
Output Address Value
4302 02
4303 00 (borrow)
With carry borrow
Input Address Value
4300 07
4301 05
Apparatus required:
8085 micro processor kit
(0-5V) DC battery
Algorithm:
Step 1 : Start the microprocessor
Step 2 : Get the 1st 8 bit in C register (LSB) and 2nd 8 bit in H
register (MSB) of 16 bit number.
Step 3 : Save the 1st 16 bit in DE register pair
Step 4 : Similarly get the 2nd 16 bit number and store it in HL register
pair.
Step 5 : Get the lower byte of 1st number into L register
Step 6 : Add it with lower byte of 2nd number
Step 7 : tore the result in L register
Step 8 : Get the higher byte of 1st number into accumulator
Step 9 : Add it with higher byte of 2nd number and carry of the lower
bit addition.
Step 10 : Store the result in H register
Step 11 : Store 16 bit addition value in HL register pair
Step 12 : Stop program execution
17
MT6411 - Microprocessor Laboratory
START
C = 00H
Transfer HL - DE
DE + HL = HL
If
Cy
=0
C = C + 01
Store HL in memory
(SUM)
Transfer C - A
STOP
18
MT6411 - Microprocessor Laboratory
Input
Without
Input Address Value
4800 01 (addend)
4801 04
4802 02 (augend)
4803 03 (augend)
Output
Output Address Value
4804 03 (sum)
4805 07 (sum)
4806 00 (carry)
19
MT6411 - Microprocessor Laboratory
With carry
Input Address Value
4800 FF (addend)
4801 DE (addend)
4802 96 (augend)
4803 DF (augend)
Result:
The assembly language program for addition of two 16 bit numbers was executed
using 8085 micro processing kit.
20
MT6411 - Microprocessor Laboratory
Apparatus required:
8085 microprocessor kit
(0-5V) DC battery
Algorithm:
Step 1 : Start the microprocessor
Step 2 : Get the 1st 8 bit numbers
Step 3 : Move the 1st 8it number to register B
Step 4 : Get the 2nd 8 bit number
Step 5 : Move the 2nd 8 bit number to register C
Step 6 : Intialise the accumulator as zero
Step 7 : Intialise the carry as zero
Step 8 : Add both register B value as accumulator
Step 9 : Jump on if no carry
Step 10 : Increment carry by 1 if there is
Step 11 : Decrement the 2nd value and repeat from step 8, till the 2nd
value becomes zero.
Step 12 : Store the multiplied value in accumulator
Step 13 : Move the carry value to accumulator
Step 14 : Store the carry value in accumulator
21
MT6411 - Microprocessor Laboratory
START
Move it to register B
No
Check for
carry?
Yes
Increment carry
No 2nd Number
Yes
END
22
MT6411 - Microprocessor Laboratory
Input
Input Address Value
4500 04
4501 02
Output
Output Address Value
4502 08
4503 00
Result:
The assembly language program for multiplication of two 8 bit numbers was executed
using 8085 micro processing kit.
23
MT6411 - Microprocessor Laboratory
Apparatus required:
8085 microprocessor kit
(0-5V) DC battery
Algorithm:
Step 1 : Start the microprocessor
Step 2 : Intialise the Quotient as zero
Step 3 : Load the 1st 8 bit data
Step 4 : Copy the contents of accumulator into register B
Step 5 : Load the 2nd 8 bit data
Step 6 : Compare both the values
Step 7 : Jump if divisor is greater than dividend
Step 8 : Subtract the dividend value by divisor value
Step 9 : Increment Quotient
Step 10 : Jump to step 7, till the dividend becomes zero
Step 11 : Store the result (Quotient) value in accumulator
Step 12 : Move the remainder value to accumulator
Step 13 : Store the result in accumulator
Step 14 : Stop the program execution
24
MT6411 - Microprocessor Laboratory
START
No
Check
for
carry?
Increment carry
Dividen
d
Yes
Store the Quotient in accumulator
END
25
MT6411 - Microprocessor Laboratory
Input
Input Address Value
4500 09
4501 02
Output
Output Address Value
4502 04 (quotient)
4503 01 (reminder)
1001
0010 I
------
0111
0010 II
------
0101
0010 III
------
0011
0010 IV
------
0001 carry
Quotient - 04
Carry - 01
Result:
The assembly language program for division of two 8 bit numbers was executed using
8085 micro processing kit.
26
MT6411 - Microprocessor Laboratory
ASCENDING ORDER
Aim:
To write a program to sort given n numbers in ascending order
Apparatus required:
8085 microprocessor kit
(0-5V) DC battery
Algorithm:
Step 1 : Start the microprocessor
Step 2 : Accumulator is loaded with number of values to sorted and it is
saved
Step 3 : Decrement 8 register (N-1) Repetitions)
Step 4 : Set HL register pair as data array
Step 5 : Set C register as counter for (N-1) repetitions
Step 6 : Load a data of the array in accumulator
Step 7 : Compare the data pointed in HL pair
Step 8 : If the value of accumulator is smaller than memory, then jump
to step 10.
Step 9 : Otherwise exchange the contents of HL pair and accumulator
Step 10 : Decrement C register, if the of C is not zero go to step 6
Step 11 : Decrement B register, if value of B is not zero, go step 3
Step 12 : Stop the program execution
27
MT6411 - Microprocessor Laboratory
START
No
Compa
re the
datas Yes Exchange the contents of
A<M memory pointer by HL
Yes
Decrement register B
No
B=0?
END
28
MT6411 - Microprocessor Laboratory
Input
Input Address Value
4500 04
4501 AB
4502 BC
4503 01
4504 0A
29
MT6411 - Microprocessor Laboratory
DESCENDING ORDER
Aim:
To write a program to sort given n numbers in descending order
Apparatus required:
8085 microprocessor kit
(0-5V) DC battery
Algorithm:
Step 1 : Start the microprocessor
Step 2 : Load the number of values into accumulator and save the
number of values in register B
Step 3 : Decrement register B for (N-1) Repetitions
Step 4 : Set HL register pair as data array address pointer and load the
data of array in accumulator
Step 5 : Set C register as counter for (N-1) repetitions
Step 6 : Increment HL pair (data address pointer)
Step 7 : Compare the data pointed by HL with accumulator
Step 8 : If the value of accumulator is larger than memory, then jump
to step 10, otherwise next step.
Step 9 : Exchange the contents of memory pointed by HL and
accumulator
Step 10 : Decrement C register, if the of C is not zero go to step 6,
otherwise next step.
Step 11 : Decrement B register, if B is not zero, go step 3, otherwise
next step.
Step 12 : Stop the program execution
30
MT6411 - Microprocessor Laboratory
START
No
Yes
Decrement register C
No
B=0?
Yes END
No
31
MT6411 - Microprocessor Laboratory
Input
Input Address Value
4500 04
4501 AB
4502 BC
4503 01
4504 0A
32
MT6411 - Microprocessor Laboratory
Apparatus required:
8085 microprocessor kit
(0-5V) power supply
Algorithm:
Step 1 : Access the channel of ADC
Step 2 : Intialise the accumulator with start of conversion signal &
output it to the ADC
Step 3 : Send 0 signal for ending the conversion for ADC
Step 4 : Get the analog value converted to display from ADC
Step 5 : The digital signal is separated into two nibbles and displayed in
hexadecimal from by calling service subroutine.
Step 6 : Go to step 1
33
MT6411 - Microprocessor Laboratory
START
Load the control word necessary for generation of ALE signal to control register
Load the control word necessary to start the conversion to control register
If the
1st
LSB
bit=1?
34
MT6411 - Microprocessor Laboratory
Result:
Thus the analog to digital conversion was done microprocessor.
35
MT6411 - Microprocessor Laboratory
Apparatus Required:
8085 Microprocessor Kit
Power
Chord
Algorithm:
Step 1: Initialise the memory location of first number in HL register pair.
Step 2: Load the first number in accumulator
Step 3: Increment the content of HL register pair to initialise the memory
location of second data
Step 4: Addition of the content of second memory location with first data
Step 5: Decimal adjustment of result
Step 6: Store the result in memory location 8002H
PROGRAM
Machine
Memory Codes Labels Mnemonics Operands Comments
address
8100 21, 50, 80 LXI H,8050 Load the address of first
number in H-L register
pair
8103 7E MOV A,M Store the first number in
accumulator
Increment H-L register
8104 23 INX H pair to
locate second number
8105 86 ADD M Addition of 1st and 2nd
number
8106 27 DAA Decimal Adjust
Store result in 8002H
8107 32, 02, 80 STA 8002 location
810A 76 HLT Halt
RESULT :
The decimal addition of two 8-bit numbers is performed using 8085 microprocessor
where sum is 8-bit.
36
MT6411 - Microprocessor Laboratory
AIM:
To write an assembly language program to convert hexadecimal to
decimal data using 8085-microprocessor kit.
APPARATUS REQUIRED:
8085 Microprocessor Kit
Power Chord
ALGORITHM:
Step1: Start the program.
Step2: Load data from memory to accumulator and move the data 00 to D and E
registers.
Step3: Compare the accumulator data with the data 64.
Step4: If carry=0 jump to Step 6 else jump to Step 5.
Step5: Jump to Step 10.
Step6: Subtract accumulator data by 64. Step7:
Increment the content of D register once.
Step8: If carry=0 jump to Step 6 else jump to Step 9.
Step9: Decrement the content of D register once and add data 64 with accumulator.
Step10: Subtract accumulator data by 0A and Increment E register content once.
Step11: If carry=0 jump to Step 10 and Decrement E register content once.
Step12: Add data 64 with accumulator and move it to C register.
Step13: Move E register content to accumulator.
Step14: Rotate the accumulator content 4 tines by left.
Step15: Add C register content with accumulator content.
Step16: Store data in accumulator pair to specified memory
Step17: Move D register content to accumulator
Step18: Store data in accumulator pair to specified memory.
Step19: End.
37
MT6411 - Microprocessor Laboratory
Memory Label
COD
Instruc E
tion Operand
38
MT6411 - Microprocessor Laboratory
411D 41
411E DCR E 1D Decrement E register content once
`411F ADI 0A C6 Add data 64 with accumulator
4120 0A
Move accumulator content to C
4121 MOV C, A 4F register
Move E register content to
4122 MOV A, E 7B accumulator
4123 RLC 07
Rotate the accumulator content 4
4124 RLC 07 tines
4125 RLC 07 by left
4126 RLC 07
Add C register content with
accumulator
4127 ADD C 81
content
4128 STA 4500 32 Store data in accumulator pair to
4129 00 specified memory
412A 45
Move D register content to
412B MOV A, D 7A accumulator
412C STA 4501 32 Store data in accumulator pair to
412D 01 specified memory
412E 45
412F HLT 76 Halt
OUTPUT:
39
MT6411 - Microprocessor Laboratory
FLOW CHART :
START
HL 8100H
A 00
B 00H
C 00H
B B+1
A A +1
Decimal adjust
accumulator
Is there
carry?
C C+1
D A, A
B
Is
A=M?
8101 A, A C
8102 A
Stop
40
MT6411 - Microprocessor Laboratory
DECIMAL TO HEXADECIMAL
AIM:
ALGORITHM:
41
MT6411 - Microprocessor Laboratory
FLOW CHART :
START
HL 4500H
A 00
B 00H
B B+1
A A +1
Decimal adjust
accumulator
Is
A=M?
A B
8101 A
Stop
42
MT6411 - Microprocessor Laboratory
INPUT OUTPUT
8100 8101
RESULT:
43
MT6411 - Microprocessor Laboratory
AIM:
To write a program fro inter facing stepper motor and to run the motor in
different directions and in different speeds.
ALGORITHM:
THEORY:
STEPPER MOTOR:
A motor in which the rotor is able to assume only discrete stationary angular
position is a Stepper Motor. The rotary motion in a stepper motor is a stepwise
manner from one equilibrium position to another.
CONSTRUCTIONAL FEATURES:
A stepper motor could be either of the reluctance type or of the permanent magnet
type (PM). A PM stepper consists of multiphase stator and two part permanent
magnet rotor. The VR stepper motor has unmagnetised rotor. PM stepper motor is the
most commonly used type. 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
winding generates a north pole (N), a south pole (S) gets induced at the diametrically
opposite side.
44
MT6411 - Microprocessor Laboratory
As shown in the figure the four pole structure is continuous with the stator
frame and the magnetic field passes through the cylindrical stator annular ring. The
rotor magnetic system has two end faces. The left face is permanently magnetized as
South Pole and their right face as North Pole. The South Pole structure and the North
Pole structure posses similar pole faces. The north pole structure is twisted with
respect to the south pole structure by one pole pitch.
45
In an arrangement where four stator poles and three poles of rotor poles, there exists 12 possible
positions in which a south pole of the rotor can lock with a north pole of the stator. From this it
can be rotated that the step size is
360o
=
Ns*Nr
where, Ns is the number of stator pole pairs Nr is the
number of pairs rotor pole
Generally step size of the stepper motor depends upon NR. These stable positions can be
attained by simply energizing the winding on any one of the stator poles with a DC. There are
three different schemes available for stepping a stepper motor. They are,
a) Wave Scheme
b) 2-Phase scheme
c) Half stepping or mixed scheme
2-PHASE SCHEME:
In this scheme any two adjacent stator windings are energized. There are two magnetic
fields active in quadrature and none of the rotor pole faces can in direct alignment with the
stator poles. A partial but symmetric alignment of the rotor poles is of course possible.
Typical equilibrium conditions of the rotor when the windings on two successive stator
poles are excited are illustrated. In Step (a) A1 and B1 are energized. The pole-face S1 tries to
align itself with the axis of A1 (N) and the pole-face S2 with B1 (N). The North Pole N3 of the
rotor finds itself in neutral zone between A1 (N) and B1 (N). S1 and S2 of the rotor position
themselves symmetrically with respect to the two stator north pole.
46
Next when B1 and A2 are energized S2 tends to align with B1 (N) and S3 with A2 (N)
of course. Again under equilibrium conditions only partial alignment is possible and N1 finds
itself in the neutral region midway between B1 (N) and A2 (N) [Step (b)]. In Step (c), A2(N)
and B2(N), respectively, with N2 in the neutral zone. Step (d) illustrates the case when A1 and
B2 are ON.
The step angle is 30 as in the two phases scheme. However the rotor is offset by 15 in
the two phases scheme with respect to the wave scheme. A total of 12 steps are required to
move the rotor by 360 (mechanical) Two Phases drives produce more torque than the wave
drives.
LOOK UP TABLE
Anticlockwise Clockwise
Step A1 A2 B1 B2 A1 A2 B1 B2
1 1 0 0 1 1 0 1 0
2 0 1 0 1 0 1 1 0
3 0 1 1 0 0 1 0 1
4 1 0 1 0 1 0 0 1
H, LOOK
4100 START: LXI UP 21 Load HL pair with memory address
4101 1A at Look Up
4102 41
4103 MVI B,04 06 Move immediate the given data
4014 04 to B register
4105 REPT: MOV A,M 7E Move content of memory to Acc.
4106 MOV [2000], AX 03 Out the content of Accumulator
4107 C0 to C0 port address
4108 LXI D, 0303H 11 Load the data 0303H to D register
4109 03
410A 03
410B DELAY: NOP 00 Perform No operation
47
410C DCX D 1B Decrement address of DE pair once
410D MOV A,E 7B Move E register content to Acc.
410E ORA D B2 Perform OR operation With Acc.
410F JNZ 410B C2 Jump on no zero to the
4110 0B instruction at specified memory
4111 41 Address
4112 INX H 23 Increment HL pair address once
4113 DCR B 05 Decrement B register content once
4114 JNZ C2 Jump on no zero to the
4115 05 instruction at specified memory
4116 41 Address
4117 JMP START C3 Jump to the instruction at
4118 00 specified memory
4119 41
411A LOOK UP 09 Data will be stored in the location
05
06
04
RESULT:
Thus the stepper motor is rotated by varying the speed using COUNT operation and
its direction is also changed using program written and executed using 8085 micro
processor kit.
48