Lab experiments
1. Programs for 16 bit arithmetic operations for 8086 (using various Addressing Modes)
a) 16 bit addition:
AIM: - To write an assembly language program for Addition of two 16-bit numbers.
APPARATUS: 1. 8086 microprocessor kit/MASM ----1
2. RPS (+5V) ----1
PROGRAM:s
i) By using MASM:
Assume cs: code
Code segment
Start: MOV AX, 4343
MOV BX, 1111
ADD AX, BX
INT 3
Code ends
End start
ii) By using 8086 kit:
MEMORY LOCATION OP-CODE LABEL MNEMONIC
0000:2000 MOV AX,4343
MOV BX,1111
ADD AX,BX
INT 3
OUTPUT:
Input Output
Register Data Register Data
AX 4343 AX 5454
BX 1111
b) Subtraction:
AIM: - To write an assembly language program for subtraction of two 16-bit numbers.
APPARATUS: 1. 8086 microprocessor kit/MASM ----1
2. RPS (+5V) ----1
PROGRAM:
k) By using MASM:
Assume cs: code
Code segment
Start: MOV AX, 4343
MOV BX, 1111
SUB AX, BX
INT 3
Code ends
End start
iii) By using 8086 kit:
MEMORY LOCATION OP-CODE LABEL INSTRUCTION
0000:2000 MOV AX,4343
MOV BX,1111
SUB AX,BX
INT 3
OUTPUT:
Input output
Register Data Register Data
AX 4343 AX 3232
BX 1111
c) Multiplication:
AIM: - To write an assembly language program for multiplication of two 16-bit numbers.
APPARATUS: 1. 8086 microprocessor kit/MASM ----1
2. RPS (+5V) ----1
PROGRAM:
A) By using MASM:
Assume cs: code
Code segment
Start: MOV AX, 4343
MOV BX, 1111
MUL BX
INT 3
Code ends
End start
B) By using 8086 kit:
MEMORY LOCATION OP-CODE LABEL MNEMONIC
2000 MOV AX,0004
MOV BX,0002
MUL BX
INT 3
OUTPUT:
Input Output
Register Data Register Data
AX 0004 AX 0008
BX 0003
d. Division
AIM: - To write an assembly language program for divison of two 16-bit numbers.
APPARATUS: 1. 8086 microprocessor kit/MASM ----1
2. RPS (+5V) ----1
PROGRAM:
A) By using MASM:
Assume cs: code
Code segment
Start: MOV AX,4343
MOV BX,1111
sss
DIV BX
INT 3
Code ends
End start
B) By using 8086 kit:
MEMORY LOCATION OP-CODE LABEL MNEMONIC
2000 MOV AX,0008
MOV BX,0002
DIV BX
INT 3
OUTPUT:
Input Output
Register Data Register Data
AX 0003 AX 0004
BX 0006
RESULT:
16 bit arithmetical operations are performed by using different addressing modes.
2. Moving a data block without overlapping
Aim:
To write an assembly program to move a piece of data from one memory location to another
Apparatus required:
1. 8086 microprocessor kit/MASM
2. RPS (+5V)
Program
(i) By Using MASM
MOV BX,3000
MOV DX,3200
MOV AX,3500
MOV SI,BX
MOV DI,AX
MOV CX,05
CLD
REP
MOVSB
MOV SI,DX
MOV DI,BX
MOV CX,05
CLD
REP
MOVSB
MOV SI,AX
MOV DI,DX
MOV CX,05
CLD
REP
MOVSB
INT 03
(ii) By Using 8086 Kit
OUTPUT:
Memory Location Input Data Memory Location Output Data
0000:3000 2,4,6 0000:3000 1,3,5
0000:3200 1,3,5 0000:3200 2,4,6
3. Code conversion of ASCII to Hexadecimal
Aim:
To write an assembly program to convert ASCII hexadecimal characters
Apparatus required:
1. 8086 microprocessor kit/MASM
2. RPS (+5V)
Program
(i) By using MASM
Write a Mnemonics only
(ii) By using 8086 kit
OUTPUT:
Enter the valid ASCII character in VALID HEX value:
Input ASCII character is 1 then Output is HEX value is 31.
If the input is valid HEX value (31-39/41-46), the program output that equivalent character as a HEX
value and repeat the sequence.
Note:HEX value(31-39/41-46) = ASCII character(1-9/A-F)
4. Code conversion of Hexadecimal Byte value to ASCII
Aim:
To write an assembly program to convert Hexadecimal Byte value to ASCII
Apparatus required:
1. 8086 microprocessor kit/MASM
2. RPS (+5V)
Program
(i) By using MASM
Write a Mnemonics only.
(ii) By using 8086 kit
OUTPUT:
Enter the HEX value in ASCII character value:
Input HEX value is 33 then Output is ASCII character is 3.
If the input is valid ASCII character(1-9/A-F), , the program output that equivalent character as a
ASCII value and repeat the sequence.
Note: HEX value(31-39/41-46) = ASCII character(1-9/A-F)
Searching a String
5. Find the largest Number in a String of array
Aim: To write an assembly program to find the largest value in a String.
Apparatus required:
1. 8086 microprocessor kit/MASM
2. RPS (+5V)
Program
(i) By using MASM
MOV AX,0000
MOV CA,AX
MOV SI,2100
MOV BH,03
MOV AL,[SI]
NXT: INC SI
DEC BH
JZ 201B
MOV BL,[SI]
CMP AL,BL
JNBE NXT
MOV AL,BL
JMP NXT
OVR: INT 03
(ii) By using 8086 kit
OUTPUT:
Memory Location Input Data Memory Location Output Data
0000:2100 2,4,6,5,0,7,5,8,9,1 0000:2000 09
Result:
Thus the program to find the largest value in an array is executed & output is verified
Sorting value of a String array
6. Find the Sorting value of a String array in ascending order
Aim: To write an assembly language program to sorting the array in ascending order.
Apparatus required:
1. 8086 microprocessor kit/MASM
2. RPS (+5V)
Program
(i) By using MASM
MOV AX,0000H
MOV DS,AX
MOV CS,AX
MOV SI,2600H
MOV CL,[SI]
DEC CL
REPT: MOV SI,2600H
MOV CH,[SI]
DEC CH
INC SI
REPCOM:MOV AL,[SI]
INC SI
CMP AL,[SI]
XCHG AL,[SI]
MOV [SI],AL
INC SI
AHEAD: DEC CH
JNZ REPCOM
DEC CL
JNZ REPT
INT 03H
(ii) By using 8086 kit
MEMORY
LOCATION OP-CODE LABEL MNEMONIC
0000: MOV AX,0000H ;NUMBER OF
2000 MOV DS,AX BYTES TO BE
MOV CS,AX
MOV SI,2600H SORTED IS
MOVED TO SI
MOV CL,[SI]
DEC CL
REPT: MOV
SI,2600H ;COUNTER VALUE
FOR INNER LOOP
MOV CH,[SI]
DEC CH
INC SI
REPCOM:MOV
; GET THE FIRST
VALUE TO BE
SORTED
AL,[SI]
INC SI
CMP AL,[SI]
; COMPARE THE
FIRST AND
SECOND VALUE
XCHG AL,[SI]
;EXCHANGE THE
VALUES
ACCORDING TO
THE COMPARISON
MOV [SI],AL \
INC SI
AHEAD: DEC CH
JNZ REPCOM
DEC CL
JNZ REPT
INT 03H ;CONTINUE THE
LOOP UNTILL THE
COMPARISON IS
DONE \
Result:
Thus the program to sorting the value is executed & output is verified
KEYBOARD DISLAY INTERFACE EXERIMENT
7. Keyboard Display interface in seven segment display unit on the
LED interface by using MASM
Aim: To write an assembly program to demonstrate keyboard display interface to display
“ELECTRO SYSTEMS’ on the LED interface using MASM
Apparatus required:
1. 8086 trainer kit
2. Key Board
3. 7 Segment Display interface unit
Program
Output: This program module display ‘ELECTRO SYSTEMS’ on the interface LEDs with a
present delay
Result:
Thus the program to execute display the ‘ELECTRO SYSTEMS’ on the interface LEDs is
executed & ouput is verified
HEX KEYPAD DISLAY INTERFACE EXERIMENT
8. HEX KEYPAD Display interface by using MASM
Aim: To write an assembly program to demonstrate hex keypad using MASM
Apparatus required:
1. 8086 trainer kit
2. Key Board and display interface unit
3. HEX keypad interface unit
\
Output: This program module display the ‘KEY PRESSED’ on the monitor display using
MASM
Result:
Thus the program to execute display the ‘KEY PRESSED’ on the monitor display is executed &
ouput is verified
9. ARITHMETIC OPERATIONS USING 8051
Aim: To write an assembly program to execute arithmetic operations using 8051.
Apparatus required:
1. 8051 trainer kit
2. RPS +5v
a) 2-8 bit addition:
OUTPUT:
Input Output
Memory
Memory address Data address Data
8102 04 8500 06
8103 02
OUTPUT:
Input Output
Memory
Memory address Data address Data
8102 04 8500 02
8103 02
OUTPUT:
Input Output
Memory
Memory address Data address Data
8102 04 8500 08
8103 02
8501 00
OUTPUT:
Input Output
Memory
Memory address Data address Data
8102 08 8500 04
8103 02
8501 00
Result:
Thus the program to execute arithmetic operations using 8086 is executed & output is verified
10. Interface of Stepper motor control using 8086
Aim: To write an assembly program to execute Stepper Motor Control using 8086
Appartus Required:
8086 Microprocessor trainer kit
Ouput:
Clockwise: 8418 ---- 09 06 05 04
Anticlockwise: 8418-- 0A 05 06 09
Result:
Thus the program to interfacing of stepper motor controller using 8086 is executed & output is
verified
11. Analog to digital conversion
Aim: To write an assembly program to using Analog to digital conversion 8086
Appartus Required:
8086 Microprocessor trainer kit
Output:
Display 1100
Voltage
00110001 31
maximum
00100101 25
2v
68
3v 01101000
21
4v 00100001
Result: Thus the ALP for interfacing of ADC using 8086 is executed & output is verified