Documente Academic
Documente Profesional
Documente Cultură
Aim:
To write an assembly language program to perform an addition, subtraction,
multiplication and division of two 16-bit numbers using 8086 microprocessor kit.
Algorithm:
16-Bit Addition
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: Clear CL register to store the carry condition.
Step 3: Add the contents of BX to AX register and store the result in AX.
Step 4: Check carry flog, If CF = 0 then go to step 6.
Step 5: Increment CL register by 1.
Step 6: Store the contents of sum and carry to output memory locations.
Step 7: Stop the execution.
16-Bit Subtraction
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: Clear CL register to store the carry condition.
Step 3: Subtract the contents of AX from BX register and store the result in AX.
Step 4: Check carry flog, If CF = 0 then go to step 6.
Step 5: Increment CL register by 1.
Step 6: Store the contents of sum and carry to output memory locations.
Step 7: Stop the execution.
16-Bit Multiplication
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: Clear DX register to store the higher order product.
Step 3: Multiply the contents of BX with AX register and store the product in DX and AX.
Step 4: Store the contents of product to output memory locations.
Step 5: Stop the execution.
16-Bit Division
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: Clear DX register to store the reminder.
Step 3: Divided the contents of BX from AX register and store the quotient in AX.
Step 4: Store the contents of reminder and quiescent to output memory locations.
Step 5: Stop the execution.
1
16 Bit Addition
Memory Address Label Mnemonics Opcodes Comments
←
1000 H MOV AX, [1100 H] A1 (AX) [1100 H]
1001 H 00
1002 H 11
1003 H MOV BX, [1102 H] 8B (BX) ← [1102 H]
1004 H 1E
1005 H 02
1006 H 11
1007 H MOV CL, 00H B1 (CL) ← 00H
1008 H 00
1009 H ADD AX, BX 03 (AX) ← (AX) + (BX)
100A H C3
100B H JNC loop-1 73 If CF=0, then go to loop-1
100C H 02
100D H INC CL FE (CL) ← (CL) + 1
100E H C1
100F H loop-1 MOV [1200 H], AX A3 [1200 H] ← (AX)
1010 H 00
1011 H 12
1012 H MOV [1202 H], CL 88 [1202 H] ← (CL)
1013 H 0E
1014 H 02
1015 H 12
1016 H HLT F4 Stop the execution
16 Bit Subtraction
Memory Address Label Mnemonics Opcodes Comments
1000 H MOV AX, [1100 H] A1 (AX) ← [1100 H]
1001 H 00
1002 H 11
1003 H MOV BX, [1102 H] 8B (BX) ← [1102 H]
1004 H 1E
1005 H 02
1006 H 11
1007 H MOV CL, 00H B1 (CL) ← 00H
1008 H 00
1009 H SUB AX, BX 2B (AX) ← (AX) + (BX)
100A H C3
100B H JNC loop-1 73 If CF=0, then go to loop-1
100C H 02
100D H INC CL FE (CL) ← (CL) + 1
100E H C1
100F H loop-1 MOV [1200 H], AX A3 [1200 H] ← (AX)
1010 H 00
1011 H 12
1012 H MOV [1202 H], CL 88 [1202 H] ← (CL)
1013 H 0E
1014 H 02
1015 H 12
1016 H HLT F4 Stop the execution
2
16 Bit Multiplication
Memory Address Label Mnemonics Opcodes Comments
←
1000 H MOV AX, [1100 H] A1 (AX) [ 1100 H]
1001 H 00
1002 H 11
1003 H MOV BX, [1102 H] 8B (BX) ← [ 1102 H]
1004 H 1E
1005 H 02
1006 H 11
1007 H MOV DX, 0000H BA (DX) ←0000H
1008 H 00
1009 H 00
100A H MUL BX F7 (DX:AX) ← (AX) * (BX)
100B H E3
100C H MOV [1200 H], AX A3 [1200 H] ← (AX)
100D H 00
100E H 12
100F H MOV [1202 H],DX 89 [1202 H] ← (DX)
1010 H 16
1011 H 02
1012 H 12
1013 H HLT F4 Stop the execution
16 Bit Division
Memory Address Label Mnemonics Opcodes Comments
1000 H MOV AX, [1100 H ] A1 (AX)←[ 1100 H]
1001 H 00
1002 H 11
1003 H MOV BX, [1102 H] 8B (BX) ← [ 1102 H]
1004 H 1E
1005 H 02
1006 H 11
1007 H MOV DX, 0000H BA (DX) ←0000H
1008 H 00
1009 H 00
100A H DIV BX F7 (DX:AX) ← (AX) / (BX)
100B H F3
100C H MOV [1200 H], AX A3 [1200 H] ← (AX)
100D H 00
100E H 12
100F H MOV [1202 H],DX 89 [1202 H] ← (DX)
1010 H 16
1011 H 02
1012 H 12
1013 H HLT F4 Stop the execution
3
16 Bit Addition
INPUT OUTPUT
Address Data Address Data
1100H
1200 H
1101 H
1201 H
1102 H
1202 H
1103 H
16 Bit Subtraction
INPUT OUTPUT
Address Data Address Data
1100 H
1200 H
1101 H
1201 H
1102 H
1202 H
1103 H
16 Bit Multiplication
INPUT OUTPUT
Address Data Address Data
1100 H 1200 H
1101 H 1201 H
1102 H 1202 H
1103 H 1203 H
16 Bit Division
INPUT OUTPUT
Address Data Address Data
1100 H 1200 H
1101 H 1201 H
1102 H 1202 H
1103 H 1203 H
Result:
The above programs were successfully executed and results were verified.
4
Ex. No.
16-BIT LOGICAL OPERATIONS
Date:
Aim:
To write an assembly language program to perform an an AND, OR, XOR and NOT
operations using 8086 microprocessor kit.
Algorithm:
16-Bit AND
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: The contents of BX is AND with AX register and store the result in AX.
Step 3: Store the contents of AX to output memory location.
Step 4: Stop the execution
16-Bit OR
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: The contents of BX is AND with AX register and store the result in AX.
Step 3: Store the contents of AX to output memory location.
Step 4: Stop the execution
16-Bit XOR
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: The contents of BX is AND with AX register and store the result in AX.
Step 3: Store the contents of AX to output memory location.
Step 4: Stop the execution
16-Bit NOT
Step 1: Get two 16-bit data from the input memory locations to AX and BX registers.
Step 2: The content of AX is complimented with NOT operation and result is stored in AX
register
Step 3: Store the contents of AX to output memory location.
Step 4: Stop the execution
5
16-Bit AND
16-Bit OR
6
16-Bit XOR
16-Bit NOT
7
16 Bit AND
INPUT OUTPUT
Address Data Address Data
1100H 1200 H
1101 H 1201 H
1102 H
1103 H
16 Bit OR
INPUT OUTPUT
Address Data Address Data
1100 H 1200 H
1101 H 1201 H
1102 H
1103 H
16 Bit XOR
INPUT OUTPUT
Address Data Address Data
1100 H 1200 H
1101 H 1201 H
1102 H
1103 H
16 Bit NOT
INPUT OUTPUT
Address Data Address Data
1100 H 1200 H
1101 H 1201 H
1102 H
1103 H
Result:
The above programs were successfully executed and results were verified.
8
Ex. No.
MOVE A DATA BLOCK WITHOUT OVERLAP
Date:
Aim:
To write an assembly language program to move a data block without overlap using 8086
microprocessor kit.
ALGORITHM:
PROGRAM:
9
INPUT:
OUTPUT:
Result:
The above programs were successfully executed and results were verified.
10
Ex. No. CODE CONVERSION
Date:
Aim:
To write an assembly language program to code conversions between different number
systems using 8086 microprocessor kit.
ALGORITHM:
PROGRAM:
INPUT:
AL = 31(HEX VALUE)
OUTPUT:
AX = 0001(ASCII VALUE)
11
BCD TO HEXADECIMAL CONVERSION
ALGORITHM:
PROGRAM:
INPUT:
10 is input value.
AL = 10.
OUTPUT:
The output value is stored in AX. AX = 000A.
12
ASCII CODE TO HEXADECIMAL
ALGORITHM:
PROGRAM:
INPUT:
OUTPUT:
13
GRAY CODE CONVERSION (LOOK UP TABLE)
ALGORITHM:
1200 00 01 03 02 06 07 05 04 0c 0d 0f 0e 0a 0b 09 08
Result:
The above programs were successfully executed and results were verified.
14
Ex. No. DECIMAL ADDITION
Date:
Aim:
To write an assembly language program to perform decimal addition and subtraction ,
matrix addition and subtraction using 8086 microprocessor kit.
15
RESULT:
INPUT:
DATA 1=
DATA 2=
OUTPUT:
DATA=
INPUT: OUTPUT:
16
DECIMAL SUBTRACTION:
RESULT:
INPUT OUTPUT
INPUT: MEMORY DATA MEMORY DATA
DATA 1= 1100 1104
DATA 2= LOCATION
1101 LOCATION
1105
1102 1106
OUTPUT:
1103
DATA=
17
MATRIX ADDITION:
18
INPUT:
MATRIX 1: MATRIX 2:
OUTPUT:
MEMORY DATA
1501
LOCATION
1502
1503
1504
1505
1506
1507
1508
1509
19
MATRIX SUBTRACTION:
20
INPUT
MATRIX 1: MATRIX 2:
OUTPUT:
MEMORY DATA
1501 11
LOCATION
1502 20
1503 30
1504 40
1505 50
1506 60
1507 70
1508 80
1509 90
Result:
The above programs were successfully executed and results were verified.
21
Ex. No.
SORTING
Date:
Aim:
To write an assembly language program to perform sorting and searching and string
manipulation using 8086 microprocessor kit.
ASCENDING ORDER
ALGORITHM:
1. Get the first data and compare with the second data
2. If the two data are in ascending order then no swap
3. Else swap the data byte by ascending order and then
again compare the other data bytes up to the count.
22
PROGRAM:
23
RESULT:
MEMORY DATA
INPUT: 1200 06
LOCATION
1201 06
1202 05
1203 04
1204 03
1205 02
1206 01
OUTPUT:
MEMORY DATA
1200 06
LOCATION
1201 01
1202 02
1203 03
1204 04
1205 05
1206 06
24
DESCENDING ORDER
ALGORITHM:
1. Get the first data and compare with the second data
2. If the two data are in descending order then no swap
3. Else swap the data byte by descending order and then
again compare the other data bytes up to the count.
25
PROGRAM:
26
RESULT:
INPUT: OUTPUT:
1200 06 1200 06
LOCATION
1201 01 LOCATION
1201 06
1202 02 1202 05
1203 03 1203 04
1204 04 1204 03
1205 05 1205 02
1206 06 1206 01
27
SEARCHING
ALGORITHM:
28
PROGRAM:
INPUT: OUTPUT:
29
STRING MANIPULATION
RESULT:
INPUT: OUTPUT:
30
REVERSE OF A DATA:
RESULT:
INPUT: OUTPUT:
31
PASSWORD CHECKING PROGRAM:
If the give password is same in the both locations then the addition program will be executed
If the give password is not equal then the program will be not executed.
32
COUNTERS AND TIME DELAY PROGRAM:
RESULT: OUTPUT:
MEMORY DATA
1200
LOCATION 01
MEMORY DATA
1201 02
1100
LOCATION 05
1202 03
1203 04
1204 06
Result:
The above programs were successfully executed and results were verified.
33
Ex. No.
TRAFFIC LIGHT CONTROLLER
Date:
Aim:
To write an assembly language program for traffic light controller.
34
FOR STOPPING VEHICLES IN N-S DIRECTION AND STARTING IN E-W DIRECTION:
35
STOPPING RIGHT TURN IN N-S SIDES AND STARTING RIGHT TURN IN E-W SIDES:
36
FOR STARTING PEDESTRAIN:
AMBER:
37
DELAY:
DELAY SUBROUTINE:
Result:
The above programs were successfully executed and results were verified.
38
Ex. No.
STEPPER MOTOR INTERFACE
Date:
Aim:
To write an assembly language program for stepper motor interface.
39
ANTI CLOCK WISE DIRECTION:
40
DELAY SUBROUTINE:
Result:
The above programs were successfully executed and results were verified.
41
Ex. No.
DIGITAL CLOCK
Date:
Aim:
To write an assembly language program for digital clock.
42
102A B1 00 MOV CL,00
102C 88 E8 MOV AL,CH
102E E8 DF 01 CALL 1210(CON IN HRS)
1031 3C 24 CMP AL,24
1033 73 D3 JNB 1008(L1)
1035 EB D5 JMP 100C(L2)
PROGRAM IN SECONDS:
43
DECIMAL CONVERTER PROGRAM IN HOURS:
DELAY PROGRAM:
Result:
The above programs were successfully executed and results were verified.
44
Ex. No.
KEYBOARD AND DISPLAY INTERFACE
Date:
Aim:
To write an assembly language program for keyboard and display interface
This program is used to interface an external hex keypad with MP-86L kit. Input clock to 8279 is
3MHZ. The program waits for a key to be entered from the keypad and the row and column
matrix of the depressed key is stored in Acc register.
45
8086 KEYBOARD PROGRAM:
46
INTERFACING 7 SEGMENT DISPLAY WITH 8086 KIT
This program is will display the character for the given 7 segment code on all the digits of the display.
FC 60 BA F2 66 D6 DE 70 FE 76 7E CE 9C EA 9E 1E
f b
e c
d .h
47
8086 DISPLAY PROGRAM:
Result:
The above programs were successfully executed and results were verified.
48
Ex. No.
PRINTER INTERFACE
Date:
Aim:
To write an assembly language program for printer interface.
LOOP1:
ADDRESS OPCODE MNEMONICS COMMENTS
1000 BE 00 20 MOV SI,2000H Start Address Of Message String
1003 B8 00 00 MOV AX,0000H Initialize The Ds To 0000h
1006 8E D8 MOV DS, AX
1008 BA 26 FF MOV DX, FF26H Control Register Address
100B B0 82 MOV AL, 82H Initialize 8255 With Port A & Port C
100D EE OUT DX, AL As Output And Port B As Input
100E BA 24 FF MOV DX, FF24H Port C Address
1011 B0 07 MOV AL, 07H For Making Strobe, Auto feed And Int
High
1013 EE OUT DX, AL To Port C
1014 E8 0A 00 CALL 1021 Print One Character
1017 8A 04 MOV AL,[SI] Get The Char To Al
1019 3C 0D CMP AL,0DH Check For Cr
101B 75 01 JNE 101E If True Terminate The Program
101D CC INT 3
LOOP2:
49
LOOP3:
ADDRESS OPCODE
2000
2004
2008
WELCOME TO MICROPROCESSOR &
200C
MICROCONTROLLER LAB
2010
2014
2018
Result:
The above programs were successfully executed and results were verified.
50
Ex. No.
SERIAL AND PARALLEL INTEREFACE
Date:
Aim:
To write an assembly language program for serial and parallel interface.
8251 PROGRAM IN 8086[BOARD] TRANSMIT:
51
2034 90 NOP NO OPERATION
2035 BA 12 FF(62 FF) MOV DX,FF12 FF12 STATUS REGISTER
2038 B0 00 MOV AL,00 DUMMY MODE WORD
203A EE OUT DX,AL MOVES DATA FROM AL TO DX
203B EE OUT DX,AL MOVES DATA FROM AL TO DX
203C EE OUT DX,AL MOVES DATA FROM AL TO DX
203D B0 40 MOV AL,40 RESET WORD
203F EE OUT DX,AL MOVES DATA FROM AL TO DX
2040 E8 0B 00 CALL 204E CALL SUBROUTINE 204E
2043 B0 4E MOV AL,4E 0100 1110
2045 EE OUT DX,AL ONE STOP BIT, NO PARITY, 8BITS CHAR
2046 90 NOP NO OPERATION
2047 90 NOP NO OPERATION
2048 B0 27 MOV AL,27 ENABLE TX
204A EE OUT DX,AL MOVES DATA FROM AL TO DX
204B 90 NOP NO OPERATION
204C 90 NOP NO OPERATION
204D C3 RET RETURN
204E 53 PUSH BX STORE THE VALUE ON TO BX
204F BB FF 04 MOV BX,04FF 04FF MOVES TO BX
2052 90 NOP NO OPERATION
2053 90 NOP NO OPERATION
2054 4B DEC BX DECREMENT BX
2055 75 FB JNE 2052 IF ZF=0,THEN GO TO 2052
2057 5B POP BX REMOVE THE VALUE FROM BX
2058 C3 RET RETURN
52
8251 PROGRAM IN 8086[BOARD] RECEIVE::
53
1031 EE OUT DX,AL MOVES DATA FROM AL TO DX
1032 B0 40 AL,40H RESET WORD
1034 EE OUT DX,AL MOVES DATA FROM AL TO DX
1035 E8 0B 00 CALL 1043 CALL SUBROUTINE 1043
1038 B0 4E MOV AL,4E 01 00 11 10
103A EE OUT DX,AL ONE STOPBIT,NO PARITY,8BITS CHAR
103B 90 NOP NO OPERATION
103C 90 NOP NO OPERATION
103D B0 27 MOV AL,27 ENABLE TX
103F EE OUT DX,AL MOVES DATA FROM AL TO DX
1040 90 NOP NO OPERATION
1041 90 NOP NO OPERATION
1042 C3 RET RETURN
1043 53 PUSH BX STORE THE VALUE ON TO BX
1044 BB FF 04 MOV BX,04FFH 04FF MOVES TO BX
1047 90 NOP NO OPERATION
1048 90 NOP NO OPERATION
1049 4B DEC BX DECREMENT BX
104A 75 FB JNE 1047 IF ZF=0,THEN GO TO 1047
104C 5B POP BX REMOVE THE VALUE FROM BX
104D C3 RET RETURN
54
INPUT: OUTPUT:
In Transmitter In Receiver
PARALLEL COMMUNICATION BETWEEN TWO MP KITS USING MODE 1 AND MODE 2 OF 8255.
55
RECEIVE:
INPUT: OUTPUT:
Transmit: Receive:
Result:
The above programs were successfully executed and results were verified.
56
Ex. No.
ADC AND DAC INTERFACE
Date:
Aim:
To write an assembly language program for ADC and DAC.
57
DELAY SUBROUTINE:
FORMULAE:
EXAMPLE:
255 x 2.5 V
= 127.5 (CONVERT THIS O/P VALUE TO HEX)
5V
= 7F 80(DIGITAL VALUE)
00 00
1.25 40
2.5 80
3.75 C0
5.0 FF
58
8086 DAC PROGRAM:
BASIC SIMPLE PROGRAM
FORMULAE:
EXAMPLE:
255 x 2.5 V
= 127.5 (CONVERT THIS O/P VALUE TO HEX)
5V
= 7F 80(DIGITAL VALUE)
59
INTERFACING USING TIMER TO GENERATE SQUARE WAVE
PROGRAM:
Result:
The above programs were successfully executed and results were verified.
60
Ex. No.
ARTHIMETIC OPERATIONS
Date:
Aim:
To write an assembly language program to perform an addition, subtraction,
multiplication and division of two 16-bit numbers using 8051microcontroller kit.
RESULT:
REGISTER VALUE
A(INPUT) 33
R1(INPUT) 55
M9000(OUTPUT) 89
61
8 BIT SUBTRACTION WITH BORROW:
RESULT:
REGISTER VALUE
A(INPUT) 66
R1(INPUT) 22
M9000(OUTPUT) 43
62
8 BIT MULTIPLICATION:
RESULT:
REGISTER VALUE
A(INPUT) 02
0F0H(INPUT) 02
M9000(OUTPUT) 04
63
8 BIT DIVISION:
RESULT:
REGISTER VALUE
A(INPUT) D5
F0(INPUT) 11
M9000(OUTPUT) 0C
Result:
The above programs were successfully executed and results were verified.
64
Ex. No.
LOGICAL OPERATIONS
Date:
Aim:
To write an assembly language program to perform logical operations using 8051.
Microcontroller kit.
AND PROGRAM:
AND OPERATION:
65
OR PROGRAM:
OR OPERATION:
66
EX-OR PROGRAM:
EX-OR OPERATION:
Result:
The above programs were successfully executed and results were verified.
67
Ex. No.
SQUARE, CUBE AND 2’S COMPLEMENT
Date:
Aim:
To write an assembly language program to perform square, cube and 2’s
complement using 8051 microcontroller kit.
SQUARE OF A NUMBER:
RESULT:
ADDRESS VALUE
M8600(INPUT) 05
M8700(OUTPUT) 19
68
CUBE OF THE NUMBER:
RESULT:
ADDRESS VALUE
M8600(INPUT) 03
M8700(OUTPUT) 1B
69
2’S COMPLEMENT
RESULT:
ADDRESS VALUE
M8500(INPUT) 04
M8600(OUTPUT) FC
Result:
The above programs were successfully executed and results were verified.
70
Ex. No.
UNPACKED BCD TO ASCII CONVERSION
Date:
Aim:
To write an assembly language program to perform unpacked BCD TO ASCII
conversion 8051 microcontroller kit.
UNPACKED BCD TO ASCII CONVERSION:
RESULT:
REGISTER VALUE
R1(INPUT) 04
R2(INPUT) 05
R3(OUTPUT) 34
R4(OUTPUT) 35
Result:
The above programs were successfully executed and results were verified.
71