Microprocessors and Microcontrollers Laboratory
Microprocessors and Microcontrollers Laboratory
TECHNOLOGY
(Approved by AICTE, New Delhi and affiliated to Anna University)
Coimbatore – 641032.
2020 – 2021
MICROCONTROLLERS _
CMS COLLEGE OF ENGINEERING AND TECHNOLOGY
(Approved by AICTE, New Delhi and affiliated to Anna University)
Date:
06/08/2021
Submitted for the university practical examination held on .................................. at
CMS College of Engineering and Technology, Coimbatore – 32
……………………………………. …………………………………….
Internal Examiner External Examiner
S.NO DATE EXPERIMENTS MARK SIGN
8 BIT ARITHMETIC
19/02/2021 SUBTRACTION USING 8086
2
8 BIT ARITHMETIC
19/02/2021
3
MULTIPLICATION USING 8086
8 BIT ARITHMETIC DIVISION
27/03/2021 USING 8086
4
06/03/2021
8 16 BIT DIVISION USING 8086
06/03/2021
9 ASCENDING ORDER USING 8086
20/03/2021
22 BIT MANIPULATION USING 8051
20/03/2021
24 FIND AND REPLACE USING 8086
FIND AN AVERAGE OF A
08/04/2021 NUMBER IN AN ARRAY USING
25 8086
8086 STEPER MOTOR
08/04/2021 INTERFACING
26 USING 8086
8086 ADDITION PROGRAM
08/04/2021 USING MASM
27
16/04/2021
28 8086 ADC PROGRAM
DISPLAY INTERFACING
16/04/2021 PROGRAM USING 8086
29
KEYBOARD INTERFACING
16/04/2021 PROGRAM USING 8086
30
SERIAL COMMUNICATION
30/04/2021 USING 8086 (8251)
31
30/04/2021
32 8086 DAC PROGRAM
SQUARE OF A NUMBER
34 06/05/2021 USING 8051 MICROCONTROLER
1
EXP NO :1
8 BIT ARITHMETIC ADDITION USING
DATE: 8086
AIM
To write an assembly language program to add two 8 bit numbers
using 8086.
ALGORITHM
Step 1: Load the first data in AC reg.
Step 2: Load the second data in BC register.
Step 3: Add the two numbers.
Step 4: Store the sum in memory.
Step 5: Stop the program.
2
PROGRAM
1003 STC F9
100A INT3 CC
INPUT:
ADDRESS DATA
1005 22
1007 33
OUTPUT:
ADDRESS DATA
AX 56
3
RESULT
Thus the addition of two 8 bit numbers using 8086 was executed and
output was verified.
4
EXP NO :2 8 BIT ARITHMETIC SUBTRACTION
DATE: USING 8086
AIM
To subtract two eight bit numbers using 8086 microprocessors.
ALGORITHM
Step 1:Load the first data n in AC register .
Step 2:load the second data in BC register.
Step 3:Subtract the two numbers.
Step 4:Store the result in memory.
Step 5:Stop the program.
5
PROGRAM
1003 STC F9
100A INT3 CC
INPUT
ADDRESS DATA
1005 02
1006 03
OUTPUT
ADDRESS DATA
AX FE
6
RESULT
Thus the subtraction of two 8 bit numbers using 8086 microprocessors
was performed and the output was verified.
7
EXP NO :3 8 BIT ARITHMETIC MULTIPLICATION
DATE: USING 8086
AIM
To write a program of two 8 bit numbers using 8086 microprocessors.
ALGORITHM
Step 1: Load the first data in AL register.
Step 2: Load the second data in BL register.
Step 3: Multiply the content of B register.
Step 4: Store the printer in memory.
Step 5: Stop the program.
8
PROGRAM
1007 INT3 CC
INPUT
ADDRESS DATA
1001 04
1003 02
OUTPUT
ADDRESS DATA
AX 08
9
RESULT
Thus the program to perform the multiplication of two 8 bit numbers
was performed and output was verified.
10
EXP NO : 4 8 BIT ARITHMETIC DIVISION USING
DATE: 8086
AIM
To write a program to perform division of two 8 bit numbers in 8086.
ALGORITHM
Step 1: Get the lowest word of dividend.
Step 2: Get the upper word of dividend.
Step 3: Perform the quotient in memory.
Step 4: Solve the quotient in memory.
Step 5: Stop the program.
11
PROGRAM
1007 INT3 - CC
INPUT
ADDRESS DATA
1000 55
1003 05
OUTPUT
ADDRESS DATA
AX 0011
12
RESULT
Thus the program to perform the division of two 8 bit numbers was
performed and output was verified.
13
EXP NO :5 16 BIT ARITHMETIC ADDITION WITH
DATE: CARRY USING 8086
AIM
To write programs to perform 16 bit addition along with carry using
8086. Processor.
ALGORITHM
Step 1: Initialize the data segment.
Step 2: Get the first number in AX register.
Step 3: Get the second number in BX register.
Step 4: Set carry flag.
Step 5: Add the two numbers along with carry.
Step 6: Stop.
14
PROGRAM
ADDRESS MNEMONICS OPERAND OPCODE
1106 STC - F9
1109 INT3 - CC
OUTPUT
AX=3334
15
RESULT
Thus the program to perform 16 bit addition along with carry is
performed and the output is verified.
16
EXP NO :6 16 BIT SUBTRACTION WITH BORROW
DATE: USING 8086
AIM
To write programs to perform 16 bit subtraction along with borrow.
using 8086 processor.
ALGORITHM
Step 1: Initialize the data segment.
Step 2: Get the first number in AX register.
Step 3: Get the second number in BX register.
Step 4: Set carry flag.
Step 5: Subtract the two numbers along with borrow.
Step 6: Stop.
17
PROGRAM
1106 STC F9
1109 INT3 CC
OUTPUT
AX=AAAB
18
RESULT
Thus the program to perform 16 bit subtraction along with borrow is
performed and the output is verified.
19
EXP NO :7
16 BIT MULTIPLICATION USING 8086
DATE:
AIM:
To write an Assembly Language Program (ALP) for performing the
multiplication operation of 16-bit numbers.
ALGORITHM:
Step 1: Get the multiplier.
Step 2 : Get the multiplicand
Step 3: Initialize the product to 0.
Step 4: Product = product + multiplicand
Step 5: Decrement the multiplier by 1
Step 6: If multiplicand is not equal to 0, repeat from step (d) otherwise store
the product
20
PROGRAM
1008 INT3 - CC
OUTPUT
AX*BX=1234*1000
AX=3400
DX=0012
21
RESULT
Thus the program for 16-bit multiplication was verified.
22
EXP NO :8
16 BIT DIVISION USING 8086
DATE:
AIM:
To write a program to perform 16 bit division using 8086 processor.
ALGORITHM
Step 1: Initialize the data segment.
Step 2: Get the first number in AX register.
Step 3: Get the second number in DX register.
Step 4: Get the third number in CX register.
Step 5: Divide the two 16 bit numbers in AX and CX.
Step 6: Stop.
23
PROGRAM
ADDRESS MNEMONICS OPERAND OPCODE
100B INT3 - CC
OUTPUT
AX=0200 (QUOTIENT)
DX=00AA (REMINDER)
24
RESULT
Thus the program to perform 16 bit division is performed and the
output is verified.
25
26
EXP NO : 9
ASCENDING ORDER USING 8086
DATE:
AIM
To write an Assembly Language Program (ALP) to sort a given array
in ascending order.
ALGORITHM
Step 1: Load the array count in two registers C1 and C2 Get the first two
numbers.
Step 2: Compare the numbers and exchange if necessary so that the two
numbers ascending order .Decrement c2.
Step 3: Get the third number from the array and repeat the process until C2
Is 0.
Step 4: Decrement C1 and repeat the process until C1 is 0.
27
PROGRAM
1006 DEC CL FE C9
1010 INC SI 46
1013 INT SI 46
101E DEC SI 4E
28
29
1021 INC SI 46
102A INT3 CC
INPUT OUTPUT
1200 07 1200 07
1201 06 1201 01
1202 05 1202 02
1203 04 1203 03
1204 03 1204 04
1205 02 1205 05
1206 01 1206 06
30
RESULT
Thus the program for sorting the data in ascending is verified.
31
EXP NO :10
DESCENDING ORDER USING 8086
DATE:
AIM
To write an Assembly Language Program (ALP) to sort a given array
in descending order.
ALGORITHM:
Step 1: Load the array count in two registers C1 and C2.
Step 2: Get the first two numbers.
Step 3: Compare the numbers and exchange if necessary so that the two
numbers are in ascending order.
Step 4: Decrement C2.Get the third number from the array and repeat the
process until c2 is 0.
Step 5: Decrement C1 and repeat the process until C1 is 0.
32
PROGRAM
ADDRESS LABEL MNEMONICS OPCODE
1010 INC SI 46
1013 INC SI 46
101E DEC SI 4E
33
34
1021 INC SI 46
102F INT 3 CC
INPUT OUTPUT
1200 07 1200 07
1201 01 1201 06
1202 02 1202 05
1203 03 1203 04
1204 04 1204 03
1205 05 1205 02
1206 06 1206 01
35
RESULT
Thus the program for sorting the data in descending order was verified.
36
EXP NO :11
MATRIX ADDITION USING 8086
DATE:
AIM
To write an assembly language program to perform matrix addition
using 8086.
37
PROGRAM
1010 INC DI 47
1011 INC SI 46
1016 INT3 CC
38
39
INPUT
2000 02 3000 04
2001 02 3001 04
2002 02 3002 04
2003 02 3003 04
2004 02 3004 04
2005 02 3005 04
2006 02 3006 04
2007 02 3007 04
2008 02 3008 04
40
41
OUTPUT
ADDRESS DATA
3000 06
3001 06
3002 06
3003 06
3004 06
3005 06
3006 06
3007 06
3008 06
42
RESULT
Thus the program for matrix addition was verified.
43
EXP NO :12
STRING MANIPULATION USING 8086
DATE:
AIM:
To move a string of length FF from source to destination.
ALGORITHM:
Step1: Initialize the data segment. (DS)
Step 2: Initialize the extra data segment. (ES)
Step 3: Initialize the start of string in the DS. (SI)
Step 4: Initialize the start of string in the ES. (DI)
Step 5: Move the length of the string (FF) in CX register.
Step 6: Move the byte from DS TO ES, till CX=0.
44
PROGRAM
ADDRESS LABEL MNEMONICS OPCODE
1009 CLD FC
100D INT3 CC
INPUT OUTPUT
1100 05 1200 05
1101 04 1201 04
1102 01 1202 01
1103 03 1203 03
1104 02 1204 02
1105 08 1205 08
45
RESULT
Thus the program for string manipulation was verified.
46
EXP NO :13
LARGEST NUMBER USING 8086
DATE:
AIM:
To write an Assembly Language Program (ALP) to find the largest in
a given array.
ALGORITHM
Step 1: Load the array count in a register C1.
Step 2: Get the first two numbers.
Step 3: Compare the numbers and exchange if the number is small.
Step 4: Get the third number from the array and repeat the process until C1 is 0.
47
PROGRAM
1005 INC SI 46
MOV [DI], AL
1018 88, 05
1019 INT3 CC
48
49
INPUT
ADDRESS DATA
1100 04
1101 05
1102 02
1103 01
1104 03
OUTPUT
ADDRESS DATA
1200 05
50
RESULT
Thus the program to find the largest in an array is performed and the
output is verified.
51
EXP NO :14
SMALLEST NUMBER USING 8086
DATE:
AIM:
To write an Assembly Language Program (ALP) to find the smallest
number in a given array.
ALGORITHM:
Step 1: Load the array count in a register C1.
Step 2: Get the first two numbers.
Step3: Compare the numbers and exchange if the number is large.
Step 4: Get the third number from the array and repeat the process until C1
is 0.
52
PROGRAM
1000 BE 00,11
MOV SI,1100
1003 8A OC
MOV CL,[SI]
1005 INC SI 46
1019 INT 3 CC
53
54
INPUT
ADDRESS DATA
1100 04
1101 05
1102 02
1103 01
1104 03
OUTPUT
ADDRESS DATA
1200 01
55
RESULT
Thus the program to find the smallest number in an array is performed and
the output is verified.
56
EXP NO :15
BCD TO HEXA DECIMAL
DATE: CONVERSIONUSING 8086
AIM
To write a program to perform BCD to Hexadecimal conversion in
8086 microprocessor.
ALGORITHM
Step1: Start the program.
Step2: Move the data 10 to AL register.
Step3: Move the content of AL to AH register.
Step4: Perform the AND operation between the contents of AH and value 0F.
Step5: Move the content of AH to BL register.
Step6: Perform the AND operation between the contents of AL and value F0.
Step7: Move the data 04 to CL register.
Step8: Rotate the upper digit to make it lower nibble.
Step9: Move the value 0A to BH register.
Step10: Multiply the content of BH and AH.
Step 11: Add the content of AL and BL.
Step12: End the program.
57
PROGRAM
ADDRESS LABEL MNEMONICS OPERAND OPCODE
1015 INT 3 CC
OUTPUT
AX=000A
58
RESULT
59
EXP NO :16
HEXADECIMAL TO ASCII CODE
DATE: CONVERSION USING 8086
AIM
To write a program to perform Hexadecimal to ASCII code conversion
in 8086 microprocessor.
ALGORITHM
Step1: Start the program.
Step2: Move the data 0A to AL register.
Step3: Compare the content of AL with the number with 09.
Step4: If a zero or equal occurs jump to the Step7.
Step5: If below or nor equal jump to the Step7.
Step6: Add the content of AL with 07.
Step7: Add the content of AL with 30.
Step8: End the program.
60
PROGRAM
100C INT 3 CC
OUTPUT
AX=0041
61
RESULT
62
EXP NO :17 8 BIT ARITHEMATIC ADDITION USING
DATE: 8051 MICROCONTROLLER
AIM:
To write a program to perform an 8bit addition using 8051 microcontroller.
63
PROGRAM
900C INC R0 08
MOVX
900E F0
@,DPTR,A
64
65
OUTPUT
8000 02
8001 01
8002 03
66
RESULT:
Thus the program is executed and the output is verified successfully.
67
EXP NO :18 8 BIT ARITHEMATIC SUBTRACTION
AIM:
To write a program to perform a 8bit subtraction using 8051 microcontroller.
68
PROGRAM
900C INC R0 08
69
70
OUTPUT:
8000 01
8001 02
8002 01
71
RESULT
Thus the program is executed and the output is verified
successfully.
72
EXP NO :19 8 BIT ARITHEMATIC
MULTIPLICATION
DATE: USING 8051 MICROCONTROLLER
AIM:
73
PROGRAM
9008 MUL AB A4
74
75
OUTPUT
8000 02
8001 04
8002 08
76
RESULT
Thus the program is executed and the output is verified successfully.
77
EXP NO :20
8 BIT ARITHEMATIC DIVISION
DATE: USING 8051 MICROCONTROLLER
AIM:
78
PROGRAM
9008 DIV AB 84
79
80
OUTPUT
8000 02
8001 08
8002 04
81
RESULT
Thus the program is executed and the output is verified successfully.
82
EXP NO :21
TRAFFIC LIGHT CONTROLLER
DATE: USING 8051
AIM:
83
PROGRAM
9005 MOVX,@DPTR,A F0
FOR STARTING VEHICLES N DIRECT&PEDEST STOPPING:
84
85
901D MOVX @DPTR,A F0
902F MOVX@DPTR,A F0
9035 MOVX@DPTR,A F0
86
87
903B MOV DPTR,#PPI 90 60 00
903E MOVX,@DPTR,A F0
9044 MOVX,@DPTR,A F0
904A MOVX@DPTR,A F0
9050 MOVX@DPTR,A F0
905B MOVX@DPTR,A F0
88
89
905C INC DPTR A3
905F MOVX,@DPTR,A F0
906A MOVX,@DPTR,A F0
90
91
907D RET 22
DELAY:
9083 RET 22
DELAY SUBROUTINE:
9088 NOP 00
9089 DEC A 14
908C DEC R2 1A
9091 JZ OUT 60 03
92
93
9093 DEC R1 19
9096 RET 22
94
RESULT
Thus the program for traffic light was performed and the output is
verified.
95
EXP NO :22
BIT MANIPULATION USING 8051
DATE:
AIM:
96
PROGRAM
DELAY ROUTINE
9104 NOP 00
9105 NOP 00
9106 NOP 00
9107 NOP 00
9108 DEC A 14
910D RET 22
97
RESULT:
Thus the program is executed and the output is verified successfully.
98
EXP NO :23
LOGICAL OPERATIONS USING 8051
DATE:
AIM:
To write a program to perform a AND, OR, XOR operations using
8051
99
AND OPERATION
OUTPUT
A = 01
OR OPERATION
OUTPUT
A = 55
100
101
XOR OPERATION
OUTPUT
A = 54
102
RESULT
Thus the program is executed and the output is verified successfully.
103
EXP NO :24 FIND AND REPLACE
DATE: USING 8086
AIM
To find and replace an element using 8086 microprocessor.
104
PROGRAM
1009 CLD FC
1010 DEC DI 4F
1017 INT3 CC
105
106
INPUT OUTPUT
1300 56 1300 56
1301 44 1301 44
1302 67 1302 67
1303 78 1303 78
1304 08 1304 30
1305 54 1305 54
107
RESULT
Thus the program is executed and the output is verified successfully.
108
EXP NO :25
FIND AN AVERAGE OF A NUMBER IN
AN ARRAY USING 8086
DATE:
AIM
109
PROGRAM
1010 INC SI 46
1017 INT3 CC
110
111
INPUT
ADDRESS DATA
9000 03
9001 03
9002 03
9003 03
9004 03
9005 03
OUTPUT
AX=0003
112
RESULT:
Thus the program is executed and the output is verified successfully.
113
EXP NO :26 8086 STEPER MOTOR INTERFACING
USING 8086
DATE:
AIM:
114
PROGRAM
CLOCKWISW DIRECTION:
115
116
101E CALL 1100 E8 DF 00
DELAY SUBROUTINE:
1106 NOP 90
1107 NOP 90
1108 NOP 90
1109 DEC AC FE C8
110D DEC BX 4B
1110 RET C3
117
RESULT:
Thus the program for rotating a stepper motor at different speed was
verified.
118
EXP NO :27 8086 ADDITION PROGRAM
DATE: USING MASM
MASM
1. Start ----------- Run
2. Run ------------CMD
3. Enter
4. DOS window opens
5. Enter (type) cd\
6. Change the directory to D by typing C :\> D
7. D:\>cd masm [open the masm folder by typing cd\masm]
8. D:\MASM debug
9. Press Enter
10.? [Type a question mark]
11. You can type a program by A1000 (a starting address)
12. A1000 [enter program]
13. 1000: MOV AX, 0001
1003: MOV BX, 0001
1006: ADD AX, BX
1008: INT3
14. Press double enters to come out of the program.
15. Type P = starting address [p=1000] Enter.
16. Display all the register values
AX: 0001 BX: 0000 CX: 0000
17. To RUN [A=1000] enter it display the output
AX: 0002, BX: 0001, CX=0000
119
EXP NO:28
8086 ADC PROGRAM
DATE:
AIM
To write an assembly language program for analog to digital
conversion using 8086.
120
PROGRAM
100E EE OUT DX AL
100F B0 FF FFH
1011 EE OUT DX AL
1018 EC IN AL,DA
1019 CC INT3
121
122
DELAY SUBROUTINE
MOV
1100 B9 FF FF
CX,FFFFF H
1103 L1 90 NOP
1104 90 NOP
1105 41 DEC CX
1106 75 FB INC
1108 C3 RET
OUTPUT
0.00 AX=0000
2.00 AX=006B
5.00 AX=00FF
123
RESULT
Thus the program for 8086 ADC was executed and output is verified
successfully.
124
EXP NO :29 DISPLAY INTERFACING PROGRAM
DATE: USING 8086
AIM
To write assembly language program for display using 8086.
125
PROGRAM
1064 DEC AH FE CC
106B IN AL,DX EC
126
127
106E JE 106CH 74 FC
128
RESULT
Thus the program was executed and output is verified.
129
EXP NO: 30 KEYBOARD INTERFACING PROGRAM
DATE: USING 8086
AIM
To write an assembly language program for keyboard interfacing using 8086.
130
PROGRAM
100C IN AL,DX EC
100F JE 100CH(LL) 74 EB
1014 IN AL,DX EC
1017 INT 3 CC
131
132
OUTPUT
21H AX=F521
13H AX=F513
11H AX=F511
133
RESULT
Thus the program was executed and the output is verified.
134
EXP NO : 31 SERIAL COMMUNICATION USING
DATE: 8086 (8251)
AIM
To write an assembly language program to perform serial communication
using 8086 microprocessor.
135
PROGRAM (RECEIVER)
1003 CALL 10 17 E8 11 00
1009 INT 3 CC
1000 IN AL,DX EC
1010 JE 10 0D 74 FB
1015 IN AL,DX EC
1016 RET C3
136
137
1021 MOV DX ,FF 00 BA 00 FF
1028 NOP 90
1029 NOP 90
102D MOV A1 00 B0 00
1032 AL 40 H B0 40
1035 CALL 10 43 E8 0B 00
103B NOP 90
138
139
103C NOP 90
1040 NOP 90
1041 NOP 90
1042 RET C3
1043 PUSH BX 53
1047 NOP 90
1048 NOP 90
1049 DEC BX 4B
104C POP BX 5B
104D RET C3
140
141
INPUT OUTPUT
IN RECEIVER ,
IN TRANSMITTER
EXECUTE THE PROGRAM
RBX=0042 G1000
142
RESULT
Thus the program for 8251 program 8086(board) was executed the
output is verified successfully.
143
EXP NO :32
8086 DAC PROGRAM
DATE:
AIM
To write an assembly language program for digital to analog converter
using 8086.
144
PROGRAM
1006 MOV FF 22 H BA 72 FF
100C INT 3 CC
OUTPUT
00 00
40 1.25
80 2.5
C0 3.75
FF 5.0
145
RESULT
Thus the program was executed and output is verified.
146
EXP NO :33 SQUARE WAVE GENERATION USING
DATE: 8086 (8253)
AIM
To write an assembly language program to generate square wave using
(8253) 8086
COUNTER 0 –>F10H
COUNTER 1FF 12 H
COUNTER 2FF 14 H
CONTROL REGFF 16H
147
PROGRAM
1012 INT 3 CC
148
RESULT
Thus the program was executed and output was verified.
149
EXP NO:34 SQUARE OF A NUMBER USING 8051
DATE: MICROCONTROLER
AIM
150
PROGRAM
9006 MUL AB A4
OUTPUT
ADDRESS VALUE
8600(INPUT) 05
8700(OUTPUT) 19
151
RESULT
Thus the program was executed and output is verified.
152
EXP NO :35 CUBE OF THE NUMBER USING 8051
DATE: MICROCONTROLLER
AIM
To write an assembly language program to perform a cube of a number
using 8051 microcontroller
153
PROGRAM
9007 MUL AB A4
9008 PUSH B C0 F0
900D MUL AB A4
ADDRESS VALUE
8600 (INPUT) 03
8700 (OUTPUT) 1B
154
RESULT
Thus the program was executed and output is verified.
155
EXP NO: 36 2’S COMPLEMENT USING 8051
DATE: MICROCONTROLLER
AIM
To write an assembly language program to perform 2’s complement of
a number using 8051 microcontroller.
156
PROGRAM
9004 CPL A F4
OUTPUT
ADDRESS VALUE
8500 (INPUT) 4
8600 (OUTPUT) FC
157
RESULT
Thus the program was executed and the output is verified.
158
EXP NO : 37 UNPACKED BCD TO ASCII CONVERSION
DATE:
AIM
To write an assembly language program to perform unpacked BCD to
ASCII conversion using 8051 microcontroller.
159
PROGRAM
9005 SWAP A C4
900E SWAP A C4
160
161
OUTPUT
REGISTER VALUE
R1 (INPUT) 4
R2 (INPUT) 5
R3 (OUTPUT) 34
R4 (OUTPUT) 35
162
RESULT
163
164