Professional Documents
Culture Documents
MICROPROCESSORS LAB
PREPARED BY VERIFIED BY
1
LIST OF EXPERIMENTS:
2
1.1FLOW CHART- ADDITION:
START
A=A+ B
Store result
Stop
3
[4151-
Ex no: 1 Date:
APPARATUS REQUIRED:
8085 Microprocessor Trainer – 1
1. 8-BIT ADDITION:
ALGORITHM
1. Start
2. Get the two numbers, which are to be added in any two of the 8085 registers.
3. Add the two numbers and store the result in the corresponding memory
location using ADD instruction.
4. Stop the execution
PROGRAM
4
1.2 FLOW CHART- SUBTRACTION
START
A=A- B
Store result
Stop
Test Data:
Output:
[4150] - [4152] -
[4151] -
5
2. 8-BIT SUBTRACTION
ALGORITHM
1. Start
2. Get the two numbers, which are to be subtracted in any two of the 8085 registers.
3. Subtract the two numbers and store the result in the corresponding memory
location using SUB instruction.
4. Stop the execution
PROGRAM
6
1.3FLOW CHART- MULTIPLICATION
START
Register =0000
Multiplier = Multiplier - 1
Is mul. = 0?
Store Register
STOP
Test Data:
[4150] = [4152] =
[4151] = [4153] =
Output:
[4154] =
[4155] =
7
3. 8-BIT MULTIPLICATION
ALGORITHM
1. Start
2. Get the multiplier and multiplicand
3. Initialize DE register pair as 0000
4. Add the multiplicand with DE register and store it DE register.
5. Decrement the multiplier by one and repeat until the multiplier becomes zero
6. Store the result in memory location
7. Stop the execution
Program:
8
1.4 FLOW CHART- DIVISION
START
Quotient = 0
Is Divid.
< Divir.
STOP
Test Data:
[4150] = - Divisor
[4151] = - Dividend
Result:
[4152] = - Remainder
[4153] = - Quotient
9
4. 8-BIT DIVISION
ALGORITHM
1. Start
2. Load the divisor and dividend
3. Initialize quotient = 0 and compare with divisor.
4. Calculate dividend = dividend – divisor
5. Quotient = Quotient + 1
6. If dividend is less than divisor then store the quotient and remainder
(dividend)
7. Stop the execution
PROGRAM:
RESULT:
Arithmetic Operations such as addition, subtraction, multiplication and division using Intel’s
8085 processor have been studied and tested for different data.
10
2.1 FLOW CHART-SMALLEST
START
Pointer = Pointer + 1
Is min≤
pointer?
Min = pointer
Count = Count - 1
Is Count
= 0?
Store Minimum
STOP
Test Data:
Output:
(4150) = (4140) =
(4151) =
(4152) =
(4153) =
(4154) =
(4155) =
11
Ex no: 2 Date:
AIM:
To write and execute programs using Intel’s 8085 processor for finding the
smallest number in an array, largest number in an array and arranging the given set of
numbers in ascending order, descending order
APPARTAUS REQUIRED:
8085 Microprocessor Trainer – 1
1.TO FIND THE SMALLEST NUMBER IN AN ARRAY OF 8 BIT NUMBERS.
ALGORITHM
1. Start
2. Initialize count, pointer and max = 0
3. Assign pointer = pointer + 1 and check for min≤ pointer, if yes then decrease the
count by one, otherwise set min = pointer
4. Check for count becomes zero, if no repeats the step 3 and 4, otherwise store the
maximum in memory.
5. Stop the execution
Program
RESULT:
Program for finding the smallest number in an array of 8 bit numbers given the length of
array has been written and executed.
12
2.2FLOW CHART-LARGEST
START
Pointer = Pointer + 1
Is max
pointer?
Max = pointer
Count = Count - 1
Is Count
= 0?
Store Maximum
STOP
Test Data:
Output:
(4150) = Count (4140) =
(4151) =
(4152) =
(4153) =
(4154) =
(4155) =
13
2.TO FIND THE LARGEST NUMBER IN AN ARRAY OF 8 BIT NUMBERS.
ALGORITHM
1. Start
2. Initialize count, pointer and max = 0
3. Assign pointer = pointer + 1 and check for max pointer, if yes then
decrease the count by one, otherwise set max = pointer
4. Check for count becomes zero, if no repeats the step 3 and 4, otherwise store
the maximum in memory.
5. Stop the execution
Program
RESULT:
Program for finding the largest number in an array of 8 bit numbers given the
length of array has been written and executed.
14
2.3.FLOW CHART-ASCENDING
START
Initialize Pointer
Count = Count – 1
Flag=0
Is pointer
≤
pointer+1?
Temp = Pointer
Pointer = Pointer + 1
Pointer+1=Temp
Pointer = Pointer + 1
Count = Count - 1
Is
count =
0?
Is Flag
= 0?
STOP
Test Data: Output:
(4150) = Count (4151)=
(4151) = (4152)=
(4152) = (4153)=
(4153) = (4154)=
15
3.TO ARRANGE THE GIVEN SET OF NUMBERS IN ASCENDING ORDER.
ALGORITHM
1. Start
2. Initialize the pointer and assign flag = 0.
3. Check for pointer is less than or equal to pointer+1, if yes then assign pointer= pointer+1,
decrement the count by one, else assign temp=pointer, pointer=pointer+1 and
pointer+1=temp.
4. Check for count is zero if yes then check flag is zero if no repeat the step 2 to 3, else stop
the execution. If count is not zero then repeat the step 3.
5. Stop the execution
Program
Label Memory Op.Code Mnemonics COMMENTS
Address
START MVI B, 00 Clear the B register content
LXI H, 4150 Count = Length of array
MOV C, M
DCR C Number of pairs = count – 1
INX H Point to start of array
LOOP MOV A, M Get K element
INX H
CMP M Compare to (k + 1) element
JC LOOP1 No interchange if K <= (K +
1)
MOV D, M Interchange if out of order
MOV M, A
DCX H
MOV M, D
INX H
MVI B, 01 B=1
LOOP1 DCR C Count down
JNZ LOOP
DCR B Is flag = 1
JZ START Do another sort, if any
HLT Stop execution
RESULT:
Program for arranging an array of 8bit numbers in ascending order has been written and
executed using 8085 trainers.
16
2.4FLOW CHART-DECENDING
START
Initialize Pointer
Count = Count – 1
Flag=0
Is pointer
pointer+1?
Temp = Pointer
Pointer = Pointer + 1
Pointer+1=Temp
Pointer = Pointer + 1
Count = Count - 1
Is
count =
0?
Is Flag
= 0?
STOP
Test Data: Output:
(4150) = Count (4151)=
(4151) = (4152)=
(4152) = (4153)=
(4153) = (4154)=
(4154) =
17
4.TO ARRANGE THE GIVEN SET OF NUMBERS IN DESCENDING ORDER.
ALGORITHM
1. Start
2. Initialize the pointer and assign flag = 0.
3. Check for pointer is greater than or equal to pointer+1, if yes then assign pointer=
pointer+1, decrement the count by one, else assign temp=pointer,
pointer=pointer+1 and pointer+1=temp.
4. Check for count is zero if yes then check flag is zero if no repeat the step 2 to 3,
else stop the execution. If count is not zero then repeat the step 3.
5. Stop the execution
Program
Label Memory Op.Code Mnemonics COMMENTS
Addres
s
START MVI B, 00 Clear the B register content
LXI H, 4150 Count = Length of array
MOV C, M
DCR C Number of pairs = count –
1
INX H Point to start of array
LOOP MOV A, M Get K element
INX H
CMP M Compare to (k + 1) element
JNC LOOP1 No interchange if K >= (K
+ 1)
MOV D, M Interchange if out of order
MOV M, A
DCX H
MOV M, D
INX H
MVI B, 01 B=1
LOOP1 DCR C Count down
JNZ LOOP
DCR B Is flag = 1
JZ START Do another sort, if any
HLT Stop execution
RESULT:
Program for arranging an array of 8bit numbers in descending order has been written and
executed using 8085 trainers.
18
3.1 FLOW CHART-ADDITION
START
(AX)=(1100)
(1102) =
ADD
(AX)=(AX)+1102
Store Result
(1200) =
STOP
Test Data:
Input: Output:
[1100] = [1200]=
[1102] =
Ex no: 3 Date:
19
PROGRAMMING USING 8086 – ARITHMETIC OPERATIONS
AIM:
To study the arithmetic operations of Intel’s 8086 processor such as addition,
subtraction, division and multiplication.
APPARATUS REQUIRED:
8086 Microprocessor Trainer – 1
1. Start
2. Load one 16bit number in AX register from memory.
3. Add the content of AX register with another 16bit number stored in another
memory location using ADD instruction.
4. Store the result in memory location
5. Stop the execution
PROGRAM:
20
3.2 FLOW CHART- SUBTRACTION
START
(AX)=(1100)
(1102) =
Subtract
(AX)=(AX)+1102
Store Result
(1200) =
STOP
2. 16-Bit SUBTRACTION:
21
ALGORITHM
1. Start
2. Load one 16bit number in AX register from memory.
3. Subtract the content of AX register with another 16bit number stored in another
memory location using SUB instruction.
4. Store the result in memory location
5.Stop the execution
PROGRAM
22
START
[1100]
=
[1102]
=
Move
AX=FEDC
Multiply
using MUL
MSW of Prod in DX
LSW of Prod in AX
STOP
3. 16 Bit Multiplication
23
ALGORITHM
1. Start
2. Load one 16 bit number from memory to AX register
3. Multiply another 16-bit number stored in memory with AX register using
MUL instruction.
4. Store the result in memory location
5. Stop the execution
PROGRAM
24
3.4 FLOW CHART- DIVISION:
START
(AX) =
(DX) =
Divide
DX: AX/Divisor
STOP
Test Data:
Output:
[1100] = [1200] = Quotient
[1102] = Dividend [1202] = Remainder
[1104]= Divisor
4.32-Bit DIVISION:
25
ALGORITHM
1. Start
2. Load the dividend and divisor in memory locations
3. Divide the dividend by divisor using DIV instruction and store the quotient and
remainder in successive memory locations
4. Stop the execution
PROGRAM:
RESULT:
Program for studying the arithmetic operations of Intel’s 8086 processor such as
addition, subtraction, multiplication and division have written and executed.
4.1 FLOW CHART: STRING MANIPULATION:
26
START
CX=length
SI Start
DI End
DF=0(clear)
Move 1byte
MOVSB
Dec CX
Is Flag
= 0?
Stop
Ex no: 4 Date:
27
PROGRAMMING USING 8086 –STRING MANIPULATION
AIM:
APPARATUS REQUIRED:
8086 Microprocessor Trainer - 1
ALGORITHM
1. Start
2. Intialize the array Length,Start address,End address
3. Move one byte
4. Decrement the length
5. Check whether length is 0.
6. Stop.
PROGRAM:
MOV CX,0FFH
CLD
MOVE
MOVSB
LOOP MOVE
HLT
RESULT:
Thus a byte string of length FF is moved from a source to a destination
5.1 FLOW CHART: INTERFACING ADC:
28
START
No Check
zero
Yes
STOP
Ex no: 5 Date:
29
INTERFACING ADC AND DAC
1. INTERFACING ADC
AIM:
To write a program for converting the analog data into a digital data.
APPARATUS REQUIRED:
ALGORITHM
1. Start.
2. Make port A &C as input and port B as output.
3. Select channel-3.
4. Make ALE1 high.
5. Make ALE1 low.
6. Check for EOC.
7. Display the result in the trainer.
30
PROGRAM:
31
LABE ADDRESS OP.CODE MNEMONICS COMMENTS
L
STAR 4100 MVI A,91H Make port A&C
T as input and port
B as output
OUT CNTRL
NOP
NOP
NOP
OUT PORTB
RESULT:
Thus the program for converting the given analog voltage (using trim pot) into digital
data is executed.
32
START
No
Yes Check
zero flag
Jump to
Start
33
To create a saw tooth wave at the output of DAC1.
APPARATUS REQUIRED:
8085 Microprocessor Trainer - 1
DAC (VLIM-002A) - 1
50-core cable - 1
ALGORITHM
1. Start.
2. Make port A &B as input and port C as output.
3. Initialize the amplitude of saw tooth wave
PROGRAM:
LABEL ADDRESS OP.CODE MNEMONICS COMMENTS
START 4100 MVI A,80H Make port A &B
as input and port C
as output
OUT CNTRL(0F)
L2 MVI A,00H
L1 OUT POTRA
INR A
CPI FF
JNZ L1
JMP L2
END
RESULT:
Thus the program for saw tooth wave form is written and the wave is generated.
34
Ex no: 6 Date:
35
PARALLEL COMMUNICATION BETWEEN TWO 8085 MP KITS
USING 8255
AIM:
To write an assembly language program for parallel communication between two
8085 microprocessor kits.
APPARATUS REQUIRED :
8085 microprocessor trainer - 2
Parallel cable - 1
ALGORITHM
Transmitter
Receiver
36
START
Stop
37
Label Memory Op.Code Mnemonics COMMENTS
Address
START MVI A,82 Initialize pointer
OUT 0F Set timer in mode 3
MVI A,3F Out the 0B content
OUT 0C Set the baud rate as 300
LOOP IN 0D Out the 08 content
SUI 3F
JNZ LOOP
MVI C,08
LXI H,4500
Trans MOV A,M
OUT 0C
CALL Delay
INX H
DCR C
JNZ Trans
RST1
MVI B,05
MVI E,FF
JNZ Delay2
DCR B
JNZ Delay1
RET
START
38
Initialize the parallel port for
Reception
Stop
39
Label Memory Op.Code Mnemonics COMMENTS
Address
START MVI A,90 Initialize pointer
OUT 0F Set timer in mode 3
Check IN 0C Out the 0B content
SUI 3F Set the baud rate as 300
JNZ Check Out the 08 content
MVI A,3F
OUT 0D
MVI C,08
CALL Delay
LXI H,4500
Rec IN 0C
MOV M,A
CALL Delay
INX H
DCR C
JNZ Rec
RST1
Delay MVI B,05
Delay1 MVI E,FF
Delay2 DCR E
JNZ Delay2
DCR B
JNZ Delay1
RET
RESULT:
Thus the program for parallel communication between 2 8085
microprocessor kits have been written and executed.
40
START
STOP
Ex no: 7 Date:
41
AIM:
To write programs using Intel’s 8085 processor
1. To display data “A”
2. Rolling Display
APPARATUS REQUIRED:
8085 microprocessor trainer,8279
7.1.DISPLAY DATA “A”
ALGORITHM
1. Start
2. Initialize 8279 and clear the seven segment displays by sending appropriate
control word
3. Out the data for display data “A” and send FF for blank display
4. Stop the execution
Program
42
START
Initialize 8279
Set count
Yes Is count No
= 0?
7.2.ROLLING DISPLAY
ALGORITHM:
1. Start
2. Initialize 8279 by choosing appropriate control word and initialize a counter
3. Read the first data from memory and out it and introduce a delay routine
43
4. Then read next data until the counter value becomes zero
5. Repeat steps 1 to 4 for rolling display
Program
Label Memory Op.Code Mnemonics COMMENTS
Address
START LXI H, Pointer Set pointer = (address)
MVI D, 0FH Initialize counter
MVI A, 10H Set Mode display
OUT CNT (CNT = c2)
MVI A, CC Clear Display
OUT CNT
MVI A, 90 Write Display
OUT CNT
LOP MVI A, M
OUT DAT
CALL DELAY
INX H Increment the pointer
DCR D Decrement the counter
JNZ LOOP Jump if non zero to
display the next char.
JMP START Jump to start
DELAY MVI B, A0
LOP1 MVI C, FF
LOP2 DCR C
JNZ LOP2
DCR B
JNZ LOP1
RET
RESULT:
Programs for displaying a data “A” and rolling a message “HELP US” have been
written and executed.
8.1 FLOW CHART-8253
START
44
Initialize 8253-control register
STOP
Ex no: 8 Date:
AIM:
45
To interface the 8253 timer IC with 8085 to get a programmed interval time
period.
APPARATUS REQUIRED:
8085 microprocessor trainer, 8253 ,CRO
ALGORITHM
1. Start
2. Initialize the control word and store it in the accumulator.
3. Out the control word by specifying the port address.
4. Store the amplitude of square wave in the accumulator and out it.
5. Stop the execution.
Program
RESULT:
Thus the program for interfacing the timer 8253 with 8085 to get a
programmed interval time period have been written and executed.
Ex no: 9 Date:
SERIAL COMMUNICATION BETWEEN TWO 8085 MP KITS
USING 8251
AIM:
46
To write an assembly language program for serial communication between two
8085 microprocessor kits.
APPARATUS REQUIRED:
8085 microprocessor trainer - 2
Serial cable - 1
ALGORITHM
Transmitter
1. Initialize the serial port for data transmission.
2. Set the baud rate as 300.
3. Initialize the memory pointer of the data to be transmitted.
4. Set the counter for verification of EOF and get the data from
consecutive memory and transmit it.
5. Reset the system.
Receiver
1. Initialize the serial port for data transmission.
2. Set the baud rate as 300.
3. Initialize the memory pointer of the data to be received.
4. Set the counter for verification of EOF , receive the data and store it in
memory location.
5. Reset the system.
47
Label Memory Op.Code Mnemonics COMMENTS
Address
START LXI H, Pointer Initialize pointer
MVI A,30 Set timer in mode 3
OUT 0B Out the 0B content
MVI A,40 Set the baud rate as 300
OUT 08 Out the 08 content
MVI A,01
OUT 08
Reload MVI C,05
CHECK IN 05
ANI 04
JZ CHECK
MOV A,M
OUT 04
INX H
CPI 3F
JNZ Reload
DCR C
JNZ CHECK
RST
48
START LXI H, Pointer Initialize pointer
MVI A,36 Set timer 0 in mode 3
OUT 0B Out the 0B content
MVI A,40 Set the baud rate as 300
OUT 08 Out the 08 content
MVI A,01
OUT 08
Reload MVI C,05
CHECK IN 05
ANI 02
JZ CHECK
IN 04
MOV M,A
INX H
CPI 3F
JNZ Reload
DCR C
JNZ CHECK
RST
49
RESULT:
Thus the program for serial communication between 2 8085
microprocessor kits have been written and executed.
Ex no: 10 Date:
AIM:
To write programs for rotating the given stepper motor at different Speed and
required angle using Intel’s 8085 processor
APPARATUS REQUIRED :
8085 Microprocessor Trainer - 1
Stepper Motor interfacing card (VBMB-13A) - 1
Stepper Motor - 1
50-core cable - 1
AT DIFFERENT SPEED
ALGORITHM
1. Start
2. Get the data derived for rotating the stepper motor from memory and
out it through port
3. Introduce a measurable delay between two successive steps by writing
delay routine
4. Repeat the steps through 2 to 3 for continuous rotation and vary the
delay for varying the speed of the motor
5. Stop the execution
50
Delay Calculation:
Required Time Delay = 1msec
Clock frequency = 3MHz
Total time delay = Delay (Inside) + Delay (Outside)
1 msec = 24 x count x 0.33sec + 20 x 0.33sec
Count = 124 = 0303H
Step angle for single step is 1.8o
No. Of steps for one rotation = 360/1.8 = 200 steps
AT DIFFERENT SPEED
Initialize ports
Yes Is No
count
= 0?
51
10.2 PROGRAM
52
10.2 AT REQUIRED ANGLE
FLOW CHART
START
No Is
count
DE =
0?
Yes
No
STOP
54
RESULT:
Programs for rotating the given stepper motor at different speed and required
angle have been written and executed.
55