Microprocessors and Microcontrollers Laboratory
Microprocessors and Microcontrollers Laboratory
MICROPROCESSORS AND
MICROCONTROLLER LAB
8086
Programs
AIM:
To write an ALP program for addition of two 16-bit numbers using 8086
APPARATUS:
8086
Microprocesso
r kit Power
supply
Keyboard
PROGRAM CODE:
INPUT:
S-3000 22
S-3002 44
OUPUT:
G 2000
S 3004-66
RESULT:
AIM:
To write an ALP program for Subtraction of two 16-bit numbers using 8086
APPARATUS:
8086
Microprocesso
r kit
Power supply
Keyboard
PROGRAM CODE:
INPUT:
S-3000 44
S-3002 22
OUPUT:
G 2000
S 3004-22
RESULT:
AIM:
To write an ALP program for Multiplication of two 16-bit numbers using 8086
APPARATUS:
8086
Microprocesso
r kit Power
supply
Keyboard
PROGRAM CODE:
INPUT:
S-3000 06
S-3001 04
S-3002 03
S-3003 05
OUPUT:
G 2000
S 3004-12
S 3005-14
RESULT:
AIM:
To write an ALP program for Division of two 16-bit numbers using 8086
APPARATUS:
8086
Microprocesso
r kit Power
supply
Keyboard
PROGRAM CODE:
INPUT:
S-3000 09
S-3001 00
S-3002 03
OUPUT:
G 2000
S 3004-03
S 3005-00
RESULT:
Hence ,the Assembly Language Program for Division of two 16-bit number
using 8086 Microprocessor was successfully completed
AIM:
APPARATUS:
8086
Microprocesso
r kit Power
supply
Keyboard
PROGRAM CODE:
INPUT:
S-3000 11
S-3001 12
S-3002 13
S-3003 14
S-3004 11
S-4000 11
S-4001 11
S-4002 11
S-4003 11
S-4004 11
OUPUT:
G 2000
S 5000-
S 5001-
S 5002-
S 5003-
S 5004-
RESULT:
Hence ,the Assembly Language Program for Multi Byte Addition using 8086
Microprocessor was successfully completed.
2B). MULTI BYTE SUBTRACTION
AIM:
APPARATUS:
8086
Microprocesso
r kit Power
supply
Keyboard
PROGRAM CODE:
INPUT:
S-3000 11
S-3001 12
S-3002 13
S-3003 14
S-3004 11
S-4000 11
S-4001 11
S-4002 11
S-4003 11
S-4004 11
OUPUT:
G 2000
S 5000-
S 5001-
S 5002-
S 5003-
S 5004-
RESULT:
Hence ,the Assembly Language Program for Multi byte Subtraction using
8086 Microprocessor was successfully completed
3. REVERSE OF A STRING
AIM:
APPARATUS:
8086
Microprocesso
r kit Power
supply
Keyboard
PROGRAM CODE:
INPUT:
S 3000 A
S 3001 B
S 3002 C
S 3003 D
S 3004 E
S 3005 F
OUPUT:
G 2000
S 4000 F
S 4001 E
S 4002 D
S 4003 C
S 4004 B
S 4005 A
RESULT:
Hence ,the Assembly Language Program for Reverse of a String using 8086
Microprocessor was successfully completed
4. LENGTH OF A STRING
AIM:
APPARATUS:
8086
Microprocesso
r kit Power
supply
Keyboard
PROGRAM CODE:
INPUT:
S 3000 A
S 3001 B
S 3002 C
S 3003 D
S 3004 E
S 3005 F
S 3006 FF
OUPUT:
G 2000
S 4000 06
RESULT:
Hence ,the Assembly Language Program for Length of a String using 8086
Microprocessor was successfully completed
5. HELLO WORLD
AIM:
APPARATUS:
8086
Microprocesso
r kit Power
supply
Keyboard
PROGRAM CODE:
00 FE
0000:200C 46 INC SI Increment SI by one
INPUT:
S 2500
The user should fill the locations from 0:2500H to 0:250DH with the
following Hexadecimal data bytes. These bytes are the HEX
equivalents of the ASCII characters contained in the output message.
0000:25 0 0 4 4 4 4 4 20 5 4 5 4 4 2 20
00 to A A 8 5 C C F 7 F 2 C 4 1
0:250DH
ASCII L L H E L L O Spac W O R L D ! Spac
Code F F e e
Welcome to SVUCE
0000: 0A 0A 57 65 6C 63 6F 6D 65 20 7 6F 20 53 56 55 4 45 20
2500 7 3
OUPUT:
“HELLO WORLD!”
RESULT:
8051 Mcirocontroller
AIM:
APPARATUS:
INPUT:
A-08
B-01
OUPUT:
G 8000
MD 5000-09
RESULT:
AIM:
To write an ALP program to perform subtraction in 8051
APPARATUS:
8051 microcontroller kit
Power Supply
Keyboard
PROGRAM CODE:
OUPUT:
G 8000
MD 5200-06
RESULT:
Hence ,the ALP to perform subtraction in 8051 was executed successfully.
11C.MULTIPLICATION
AIM:
To write an ALP program to perform multiplication in 8051.
APPARATUS:
ESA trainer kit-8051
Keyboard
Power supply.
PROGRAM:
ADDRESS OP CODE MNEMONICS COMMENTS
0000:8000 74 13 MOV A,#13 Move the value 13 to A
0000:8002 75 F0 49 MOV 0F0,#49 Move the value 49 to 0F0
0000:8005 A4 MUL AB Multiplies contents of A and B
0000:8006 90 52 00 MOV DPTR,#5200 Move the address 5200 to DPTR
0000:8009 F0 MOVX @DPTR,A Move the result from A to DPTR
0000:800A A3 MOV A,OFO Move the contents from 0F0 to A
0000:800C F0 INC DPTR Increment DPTR by 1
0000:800D 02 00 00 MOVX @DPTR,A Move contents to DPTR from A
0000:800E LJMP 03 Long jump to address 0000H
INPUT:
A-13
B-49
OUTPUT:
0000:5200-F9H
0000:5201-04H.
RESULT:
Hence the ALP program to perform multiplication in 8051 was executed
successfully.
11D.DIVISION
AIM:
To write an ALP program to perform division in 8051.
APPARATUS:
ESA trainer kit-8051
Keyboard
Power supply.
PROGRAM:
ADDRESS OP CODE MNEMONICS COMMENTS
0000:8000 74 AB MOV A,#ABH Move the value AB to A
0000:8002 75 F0 12 MOV 0F0,#12H Move the value 12 to 0F0
0000:8005 84 DIV A,B Divides contents of A by B
0000:8006 90 52 00 MOV DPTR,#5200 Move the address 5200 to DPTR
0000:8009 F0 MOVX @DPTR,A Move the address from A to DPTR
0000:800A E5 F0 MOV A,0F0 Move the contents from A to DPTR
0000:800C A3 INC DPTR Increment DPTR by 1
0000:800D F0 MOVX @DPTR,A Move value from A to DPTR
0000:800E 02 00 00 LJMP 0 Long jump to address 0000H
INPUT:
A-ABH
B-12H
OUTPUT:
0000:5200-09H
0000:5201-09H
RESULT:
Hence the ALP program to perform division in 8051 was executed
successfully.
AIM:
To write an ALP program to find 1’s and 2’s compliment in an array.
APPARATUS:
ESA trainer kit-8051
Keyboard
Power supply.
PROGRAM:
ADDRESS OP CODE MNEMONICS COMMENTS
8000 74 05 MOV A,05 Give the value to A as 05
8002 F4 CPL A Compliment of A
8003 90 42 00 MOV DPTR,#4200 Give the address 4200 to DPTR
8006 F0 MOVX @DPTR,A Move the result from A to DPTR
8007 04 INC A Increment of A
8008 A3 INC DPTR Increment of DPTR
8009 F0 MOVX @DPTR,A Move contents to DPTR from A
8008 FC LJMP 03 Long jump to address 8008
OUTPUT:
MD 4200[FA]
MD 4201[FB]
RESULT:
Hence to write an ALP program to find 1’s and 2’s compliment in an
array was successfully completed.
AIM:
To write an ALP program to find the factorial of a given number.
APPARATUS:
8051 Microcontroller Kit
Keyboard
Power supply
PROGRAM CODE:
OUTPUT:
MD 4201 = 06
RESULT:
Hence to find the factorial of a given number was successfully completed.
MASM Programs
13a. ADDITION
AIM:To Write an ALP to perform addition using MASM software
PROGRAM CODE:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
ORG 0100H
X DW 0007
Y DW 0004
Z DW 2000
DATA ENDS
CODE SEGMENT
ORG 200H
START: MOV AX,DATA
MOV DS,AX
MOV AX,X
MOV BX,Y
ADD AX,BX
MOV DI,OFFSET Z
MOV [DI],AX
INT 21H
CODE ENDS
END START
RESULT:
13b. SUBTRACTION
AIM:To Write an ALP to perform subtraction using MASM software
PROGRAM CODE:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
ORG 0100H
X DW 0007
Y DW 0004
Z DW 2000
DATA ENDS
CODE SEGMENT
ORG 200H
START: MOV AX,DATA
MOV DS,AX
MOV AX,X
MOV BX,Y
SUB AX,BX
MOV DI,OFFSET Z
MOV [DI],AX
INT 21H
CODE ENDS
END START
RESULT:
13c. MULTIPLICATION
AIM:To Write an ALP to perform multiplication using MASM software
PROGRAM CODE:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
ORG 0100H
X DW 0008
Y DW 0004
Z DW 2000
DATA ENDS
CODE SEGMENT
ORG 200H
START: MOV AX,DATA
MOV DS,AX
MOV AX,X
MOV BX,Y
MUL BX
MOV DI,OFFSET Z
MOV [DI],AX
INT 21H
CODE ENDS
END START
RESULT:
13d. DIVISION
AIM:To Write an ALP to perform division using MASM software
PROGRAM CODE:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
ORG 0100H
X DW 0008
Y DW 0004
Z DW 2000
DATA ENDS
CODE SEGMENT
ORG 200H
START: MOV AX,DATA
MOV DS,AX
MOV AX,X
MOV BX,Y
DIV BX
MOV DI,OFFSET Z
MOV [DI],AX
INT 21H
CODE ENDS
END START
RESULT:
AIM:To Write an ALP to perform display the reverse string using MASM software
PROGRAM CODE:
RESULT:
AIM:To write an ALP program to arrange ‘n’ number in ascending order using
MASM software
PROGRAM CODE:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
A DB 05H,03H,01H,04H,02H
DATA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV DL,04H
UP2: MOV CL,DL
LEA SI,A
UP1: MOV AL,[SI]
CMP AL,[SI+1]
JA DOWN
XCHG AL,[SI+1]
XCHG AL,[SI]
DOWN: INC SI
DEC CL
JNZ UP1
INT 03
CODE ENDS
END START
RESULT:
PROGRAM CODE:
ASSUME CS:CODE , DS:DATA
DATA SEGMENT
A DB 05H,03H,01H,04H,02H
DATA ENDS
CODE SEGMENT
START: MOV AX,DATA
MOV DS,AX
MOV DL,04H
UP2: MOV CL,DL
LEA SI,A
UP1: MOV AL,[SI]
CMP AL,[SI+1]
JB DOWN
XCHG AL,[SI+1]
XCHG AL,[SI]
DOWN: INC SI
DEC CL
JNZ UP1
INT 03
CODE ENDS
END START
RESULT:
AIM:To display a message on the CRT screen of a microcomputer using DOS calls.
ALGORITHM:
1. Initialize the data segment and the message to be displayed.
2. Set function value for display.
3. Point to the message and run the interrupt to display the message in the
CRT monitor.
PROGRAM:
ASSUME CS: CODE, DS: DATA
DATA SEGMENT
STR1 DB “GOOD MORNING”
DATA ENDS
CODE SEGMENT
START: MOV AX, DATA
MOV DS, AX
LEA SI,STR1
CLD
MOV CL,12
INT 03H
CODE ENDS
END START
RESULT:A message “GOOD MORNING”, is displayed on the CRT screen of a
microcomputer using DOS calls.
8085
Programs
AIM:
To write an ALP program for addition of two 16-bit numbers using 8085
APPARATUS:
Power supply
Keyboard
PROGRAM CODE:
INPUT:
A- 03
B- 02
OUPUT:
8500- 05
RESULT:
Thus,the ALP for addition of two numbers using 8085 was executed
successfully.
AIM:
To write an ALP program for subtraction of two 16-bit numbers using 8085
APPARATUS:
Power supply
Keyboard
PROGRAM CODE:
INPUT:
A- 06
B- 04
OUPUT:
8500- 02
RESULT:
Thus,the ALP for addition of two numbers using 8085 was executed
successfully.