Beruflich Dokumente
Kultur Dokumente
EX NO: 1.1
8-BIT ADDITION
DATE:
AIM:
To write an assembly language program to perform the 8-bit addition using 8086
instruction.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Algorithm
Input
Output
Flowchart
Program
ADDRESS OPCODE
MNEMONICS
MOV
COMMENTS
1100
BE 00 15
SI, 1500
1103
AD
1104
89 C3
1106
AD
1107
01 C3
ADD
BX, AX
1109
BF 20 15
MOV
DI, 1520
110C
89 1D
MOV
[DI], BX
110E
74
LODSW
MOV
BX, AX
LODSW
HLT
HALT
INPUT:
ADDRESS
DATA
ADDRESS
DATA
OUTPUT:
EX NO: 1
EX NO: 1.2
8-BIT SUBTRACTION
DATE:
AIM:
To write an assembly language program to perform the 8-bit subtraction using 8086
instruction.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Algorithm
Input
Output
Flow Chart
Program
ADDRESS OPCODE
MNEMONICS
COMMENTS
1100
BE 00 15
MOV SI,1500
1103
AD
LODSW
1104
89 C3
MOV BX, AX
1106
AD
LODSW
1107
01 C3
SUB BX, AX
subtract AX from BX
1109
BF 20 15
110C
89 1D
MOV [DI],BX
110E
CC
INT 3
Break point
5
INPUT:
ADDRESS
DATA
ADDRESS
DATA
OUTPUT:
EX.NO:1.3
DATE:
AIM:
To write an assembly language program to perform the 8-bit multiplication using 8086
instruction.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Algorithm
Input
Output
Flow Chart
Program
ADDRESS OPCODE
MNEMONICS
COMMENTS
1100
BE 00 15
MOV SI,1500
1103
AD
LODSW
1104
89 C3
MOV BX, AX
1106
AD
LODSW
1107
F7 E3
MUL BX
1109
BF 0 5 15
110C
89 05
MOV [DI], AX
110E
47
INC DI
Increment the DI
110F
47
INC DI
Increment the DI
1110
89 15
MOV [DI], BX
1112
CC
INT 3
Break point
INPUT:
ADDRESS
DATA
ADDRESS
DATA
OUTPUT:
EX.NO:1.4
DATE:
AIM:
To write an assembly language program to perform the 8-bit division using 8086
instruction.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Algorithm
Input
Output
10
Flow Chart
11
Program
ADDRESS OPCODE
MNEMONICS
COMMENTS
1100
Clear DX registers
1103
1106
B9 0F 00 MOV BX, 0F
1109
110B
F7 F1
DIV BX
110E
88 05
1110
47
1111
88 25
1113
47
1114
89 15
1116
CC
MOV [DI], AL
INC DI
Increment DI
MOV [DI], AH
INC DI
Increment DI
MOV [DI], DX
INT3
Break point
INPUT:
ADDRESS
DATA
ADDRESS
DATA
OUTPUT:
12
EX NO: 2
EX NO: 2.1
DATE:
AIM:
To write an assembly language program to perform the string manipulation operation by
moving data one location to other location.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Flow Chart
13
Algorithm
Input
Input data from address 1500 which is pointed SI, transferred to the desired
Location.
Number of byte in CL.
Output
Program
ADDRESS OPCODE MNEMONICS
1100
1102
B1 08
BE 00 14
MOV CL, 05
COMMENTS
Load 08 value into CL
1105
BF 50 14
1108
LOOP1:
MOV AX,[SI]
1109
88 05
INC SI
110B
47
MOV [DI],AX
110C
FE C9
INC DI
110E
75 F8
DEC CX
1110
CC
JNZ LOOP1
1113
MOV AH,4CH
1114
INT 21H
Break point
14
TABULATION:
INPUT
ADDRESS
OUTPUT
DATA
ADDRESS
15
DATA
EX NO: 3
EX NO: 3.1
DATE:
AIM:
To write an assembly language program to perform the search operation and to find the
biggest number in an given array using 8086.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Searching a Byte
Flow Chart
16
Algorithm
Initialize the pointer to the memory for storing data and result.
Load DL with search byte.
Load CL with count.
Load AL with data from memory. Compare AL with DL if its equal store the
result else decrement counts go to step2.
Store the result.
Input
MOV CX,0005H
1103
MOV SI,1400H
1106
1108
110A
MOV AL,[SI]
INC SI
DEC CX
110B
110D
JNC LOOP2
110F
MOV AL,[SI]
1111
1113
COMMENTS
LOOP2: INC SI
DEC CX
1114
JNZ LOOP1
1116
MOV SI,1500H
1117
MOV [SI],AL
1119
MOV AH,4CH
111A
INT 21H
17
TABULATION:
INPUT
ADDRESS
OUTPUT
DATA
ADDRESS
18
DATA
EX NO: 3
EX NO: 3.2
REPLACE OPERATION
DATE:
AIM:
To write an assembly language program for replacing a data with given data for specified
location using 8086.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
MOV CX,0005H
1103
MOV AX,77H
1106
1108
110A
MOV SI,1200H
MOV [SI],AX
INC SI
LOOP:
110B
DEC CX
110D
JNZ LOOP
110F
MOV AH,4CH
1111
INT 21H
COMMENTS
TABULATION:
INPUT
ADDRESS
OUTPUT
DATA
ADDRESS
19
DATA
EX NO: 3
EX NO: 3.3
COPY OPERATION
DATE:
AIM:
To write an assembly language program for copying the data at one location to another
using 8086.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
PROGRAM:
ADDRESS OPCODE MNEMONICS
1100
COMMENTS
MOV CX,0005H
MOV SI,1400H
LOOP:
MOV DI,1500H
MOV AX,[SI]
MOV [DI],AX
ADD SI,0002H
ADD DI,0002H
DEC CX
JNZ LOOP
MOV AH,4CH
INT 21H
TABULATION:
INPUT
ADDRESS
OUTPUT
DATA
ADDRESS
20
DATA
EX NO: 3
EX NO: 3.4
DATE:
Descending Order
AIM:
To write an assembly language program for arranging the datas in descending order using
8086.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Algorithm
Get the first data and compare with the second data.
If the two data are in descending order then no swap.
Else swap the data byte by descending order and then again compare the other
data bytes up to the count.
Do the above the array is a ranged in descending order.
Finally the array is arranged in ascending order.
Input
Output
21
Flow chart
22
Program
ADDRESS OPCODE
MNEMONICS
COMMENTS
1100
BE 00 90
1103
8A 0C
1105
BE 00 90
1108
8A 14
110A
46
INC SI
110B
8A 04
first data in AL
110D
FE CA
DEC DL
Decrement DL
110F
74 16
JZ 1127
1111
46
INC SI
Increment SI
1112
8A 1C
1114
3A C3
CMP AL, BL
if al > bl go to (jump1)
1116
72 07
JB 111F
1118
4E
DEC SI
Decrement SI
1119
88 04
MOV [SI],AL
111B
88 D8
MOV AL, BL
111D
EB 03
JMP 1122
111F
4E
DEC SI
Decrement SI
1120
88 1C
MOV [SI], BL
1122
46
INC SI
Increment SI
1123
FE CA
DEC DL
Decrement DL
1125
75 EA
JNZ 1111
1127
88 04
MOV [SI], AL
1129
FE C9
DEC CL
Decrement CL
112B
75 D8
JNZ 1105
112D
CC
INT3
Break point
TABULATION:
INPUT
ADDRESS
OUTPUT
DATA
ADDRESS
23
DATA
EX NO: 3
EX NO: 3.5
DATE:
Ascending Order
AIM:
To write an assembly language program for arranging the datas in Ascending order using
8086.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Algorithm
Get the first data and compare with the second data.
If the two data are in ascending order then no swap.
Else swap the data byte by ascending order and then again compare the other data
bytes up to the count.
Do the above the array is arranged in ascending order.
Finally the array is arranged in ascending order.
Input
Output
Flow chart
25
Program
ADDRESS OPCODE
MNEMONICS
COMMENTS
1100
BE 00 90
1103
8A 0C
1105
BE 00 90
1108
8A 14
110A
46
INC SI
Increment SI
110B
8A 04
110D
FE CA
DEC DL
Decrement DL
110F
74 16
JZ 1127
1111
46
INC SI
Increment SI
1112
8A 1C
1114
38 D8
CMP AL, BL
if AL > BL go to (jump1)
1116
72 07
JNB 111F
1118
4E
DEC SI
Decrement SI
1119
88 04
MOV [SI],AL
111B
88 D8
MOV AL, BL
111D
EB 03
JMP 1122
111F
4E
DEC SI
Decrement SI
1120
88 1C
MOV [SI], BL
1122
46
INC SI
Increment SI
1123
FE CA
DEC DL
Decrement DL
1125
75 EA
JNZ 1111
1127
88 04
MOV [SI], AL
1129
FE C9
DEC CL
Decrement CL
112B
75 D8
JNZ 1105
INT3
Breakpoint
112D
CC
TABULATION:
INPUT
ADDRESS
OUTPUT
DATA
ADDRESS
26
DATA
EX NO: 4
EX NO: 4.1
DATE:
AIM:
To write an assembly language program for converting the gray code from Binary using
8086.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Flow Chart
Algorithm
Load the memory with truth table of gray codes.
Initialize the pointer to the memory for data and result.
Load AL with the data from memory.
Convert gray code for that data.
27
Data in 1500.
Output
Result in 1501.
Lookup Table
The look up table is provided by hex or of two bits in a byte the value ranges from 00 to
0f. 1600 - 00 01 03 02 06 07 05 04 0c 0d 0f 0e 0a 0b 09 08.
Program
ADDRESS OPCODE
BB 00 12
1100
MNEMONICS
MOV BX, 1600
COMMENTS
Load 1200 into BX
1103
BE 50 11
1106
AC
LODSB
1107
D7
XLAT
1108
BF 51 11
110B
88 05
MOV [DI], AL
110D
CC
INT3
Break point
28
EX NO: 4
EX NO: 4.2
DATE:
AIM:
To write an assembly language program for converting the ascii code into Hex Code using
8086.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Flow Chart
29
Algorithm
Input
MNEMONICS
COMMENTS
1100
B0 31
MOV AL,31
1102
2C 30
SUB AL,30
1104
3C 10
CMP AL,10
1106
72 04
JB 110C
1108
74 02
JZ 110C
110A
2C 07
SUB AL,07
110C
CC
INT 3
Break point
30
EX NO: 4
EX NO: 4.3
DATE:
AIM:
To write an assembly language program for converting the BCD code into Hex Code using
8086.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Flow Chart
31
Algorithm
Input
Data in AL register.
Output
Result in AL register.
Program
ADDRESS OPCODE
MNEMONICS
COMMENTS
1100
B0 10
MOV AL,10
1102
88 C4
MOV AH,AL
1104
80 E4 OF
AND AH,0F
1107
88 E3
MOV BL,AH
1109
24 F0
AND AL,F0
110B
B1 O4
MOV CL,04
110D
D2 C8
ROR AL,CL
110F
B7 0A
MOV BH,0A
1111
F6 E7
MUL BH
Multiply by 10
1113
00 D8
ADD AL,BL
1115
CC
INT3
Break point
32
EX NO: 4
EX NO: 4.4
DATE:
AIM:
To write an assembly language program for converting the Hex code into ASCII Code
using 8086.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Flow Chart
33
Algorithm
Input
Data in AL register.
Output
Result in AL register.
Program
COMMENTS
1100
B0 0A
MOV AL,0A
1102
3C 09
CMP AL,09
1104
74 04
JZ 110A
1106
72 02
JB 110A
1108
04 07
ADD AL,07
110A
04 30
ADD AL,30
add 30 with AL
110C
CC
INT3
Break point
st
34
EX NO: 4
EX NO: 4.5
MATRIX ADDITION
DATE:
AIM:
To write an assembly language program for adding 2x2 Matrix without carary using 8086.
APPARATUS REQUIRED:
*8086 Microprocessor trainer kit
*Power supply
Flow Chart
35
Algorithm
Input
Data in 2000 consecutive location as rows and columns for first matrix.
Data in 3000 consecutive location as rows and columns for second matrix.
Output
MNEMONICS
COMMENTS
1100
B1 09
MOV CL, 09
1102
BE 00 20
1105
BF 00 30
1108
110A
110C
8A 04
8A 1D
00 D8
110E
88 05
MOV [DI], AL
1110
47
INC DI
Increment DI
1111
1112
46
FE C9
INC SI
DEC CL
1114
75 F2
JNZ 1108
Increment SI
Decrement CL
Loop continues until all elements of
Matrix to added
1116
CC
INT3
Break point
36
EX.NO: 5
DATE:
AIM:
To write as assembly language program to convert an analog signal into a digital
signal using an ADC interfacing.
APPARATUS REGUIRED:
Microprocessor kit 8086 kit.
Power supply - +5v DC.
ADC interface board.
PROBLEM STATEMENT:
The program is executed for various values of analog voltage which are set
with the help of a potentiometer. The LED directly is verified with the digital value that
is shorted in a memory location.
ALGORITHM:
200A
200C
200E
2010
2012
2014
2016
2018
201A
201C
201E
2020
2023
2025
L1
OUT 0D0H,AL
MOV AL,00
MOV AL,00
MOV AL,00
MOV AL,00
E6 D0
B0 00
B0 00
B0 00
B0 00
OUT 0D0H,AL
IN AL,0D8H
AND AL,01
CMP AL,01
JMZ 2022
E6 D0
E4 D8
24 01
3C 01
75 04
IN AL,0C0H
MOV
BX,1100
MOV [BX],AL
HLT
E4,C0
BB 00 11
88 07
F4
FLOWCHART:
Start
If
EOC=1
stop
38
MODEL GRAPH:
Amplitude
= 1.8 2v.
RESULT:
Thus the ADC was interfaced with 8086 and the given analog were converted into its digital
equivalent.
39
EX.NO:6
DATE:
AIM:
To write an assembly language program (ALP) for digital to analog
conversion and to convert digital output into analog output and to generate
different waveforms.
APPARATUS REQUIRED:
Microprocessor kit - 8086 kit.
Power supply.
DAC interface board.
ALGORITHM:
MEASUREMENT OF ANALOG VOLTAGE
WAVEFORM GENERATION
SQUARE WAVEFORM:
SAWTOOTH WAVEFORM:
TRIANGULAR WAVEFORM:
PROGRAM:
MESUREMENT OF ANALOG VOLTAGE:
ADDRESS
2000
2002
2003
MNEMONICS
MOV AL,7FH
OUT DX,AL
HLT
OPCODE
B0 00
EE
F4
COMMENTS
Load digital value 00 in accumulator
Send through output port
Stop
LABLE
L2
L1
L3
MNEMONICS
MOV AL,00H
OUT DX,AL
CALL ,200E
MOV AL,FFH
OUT DX,AL
CALL 200E
JMP 2000
MOV CX,05FFH
LOOP 2011
RET
OPCODE
B0 00
EE
E8 15 00
B0 7F
EE
E8 0F 00
EB F2
B9 FF 05
E2 0C
00 E6
41
COMMENTS
Load 00 in accumulator
Send through output port
Give a delay
Load FF in accumulator
Send through output port
Give a delay
Go to starting location
Load count value in CX register
Decrement until it reaches zero
Return to main program
LABLE
L2
L1
2006
MNEMONICS
MOV AL,00H
OUT DX,AL
INC AL
JNZ 2002
OPCODE
B0 00
EE
FE C0
75 FB
JMP 2000
EB F7
COMMENTS
Load 00 in accumulator
Send through output port
Increment contents of accumulator
Send through output port until it
reaches FF
Go to starting location
LABLE MNEMONICS
L3
MOV AL,00H
L1
OUT DX,AL
INC AL
JNZ 2002
L2
OPCODE
B0 00
EE
FE C0
75 FB
MOV AL,0FFH
OUT DX,AL
DEC AL
JNZ 2009
B0 00
EE
FE C8
75 FB
JMP 2000
EB F0
42
COMMENTS
Load 00 in accumulator
Send through output port
Increment contents of accumulator
Send through output port until it
reaches FF
Load FF in accumulator
Send through output port
Decrement contents of accumulator
Send through output port until it
reaches 00
Go to starting location
FLOWCHART:
MEASUREMENT OF ANALOG VOLTAGE
START
Send the digital value of
accumulator
STOP
SQUARE WAVEFORM:
STRAT
Initialize the
accumulator and ACC
Delay
Load the ACC with max
value send ACC content
Delay
43
TRIANGULAR WAVE:
START
Initialize
accumulator
Send accumulator
content to DAC
Increment accumulator
Is
ACC<=FF
yes
NO
Decrement
accumulator content
Send accumulator
Yes
Is
ACC<=00
44
No
SAWTOOTH WAVE:
START
Initialize accumulator
Send accumulator
Increment accumulator
NO
Is
ACC<FF
YES
MODEL GRAPH:
SQUARE WAVE:
amplitude
t(m)
TRIANGULAR WAVE:
amplitude
45
t(m)
SAWTOOTH WAVE:
amplitude
t(m)
RESULT:
Thus the DAC was implemented with 8086 and different waveforms have
been generated .
46
EX.NO:7
DATE:
AIM:
Interface Traffic light controller with 8086 using 8255
PROCEDURE:
Connect a 20pin FRC cable between 8086 Microprocessor J6 port (Third port) or
J8 port (First port) and the Traffic light controller.
Program can be tested with GPIOII (8255) J6 or with GPIOI (8255) -J8.
Type the Program by using USB/ PS2 Key board.
Execute the Program. Now Traffic Light Leds are blinking.
PROGRAM:
Comments
ADDRESS
OPCODE
MNEMONICS
1100
BB 00 12
START: MOV BX, 1200H
1103
B9 08 00
MOV CX, 0008H
1106
8A 07
MOV AL,[BX]
1108
BA 36 FF
MOV DX, FF36
110B
EE
OUT DX, AL
110C
43
INC BX
110D
8A 07
NEXT: MOV AL,[BX]
110F
BA 30 FF
MOV DX, FF30
1112
EE
OUT DX,AL
1113
43
INC BX
1114
8A 07
MOV AL,[BX]
1116
BA 32 FF
MOV DX,FF32
1119
EE
OUT DX,AL
111A
E8 06 00
CALL DELAY
111D
43
INC BX
111E
49
DEC CX
111F
75 ED
JNZ NEXT
1121
EB DD
JMP START
1123
51
DELAY: PUSH CX
1124
B9 0F 00
MOV CX,000F
1127
BA FF FF
REPEAT: MOV DX,FFFFH
112A
4A
LOOP2: DEC DX
112B
75 FD
JNZ LOOP2
112D
E2 F8
LOOP REPEAT
112F
59
POP CX
1130
C3
RET
47
ORG 1200H
1200 80
DB 80H
1201 21 09 31 09
DB 21H,09H,31H,09H
1205 0C 09 8C 09
DB 0CH,09H,8CH,09H
1209 64 08 64 0C
DB 64H,08H,64H,0CH
120D 24 03 26 03
DB 24H,03H,26H,03H
48
EX.NO:8
DATE:
AIM:
To Interface printer with 8086 using 8255
Apparatus Required:
8086 Processor
Power Supply
Printer
PROGRAM:
ADDRESS
1100
1103
1105
1108
1109
110B
110E
110F
1111
1114
1115
1117
111A
111D
1120
1122
1125
1127
112A
112C
112F
1131
LABEL
PRINT:
MNEMONICS
COMMENTS
MOV SI,1200H
MOV AL,0B6H
MOV DX,0FF06H
OUT DX,AL
MOV AL,040H
MOV DX,0FF04H
OUT DX,AL
MOV AL,01H
MOV DX,0FF04H
OUT DX,AL
MOV AL,00H
CALL SENDUART
CALL SENDUART
CALL SENDUART
MOV AL,040H
CALL SENDUART
MOV AL,04DH
CALL SENDUART
MOV AL,05H
CALL SENDUART
MOV BL,0AH
MOV DX,0FF10H
Load 1200 in to SI
8253 Channel 2
8253 control Reg for channel2
Clock divider LSB
8253 control data for channel2
Clock divider MSB
8253 control data for channel2
49
SENDCHAR:
1134
1136
1137
113A
113B
113D
113F
1141
1144
1145
1148
114A
SENDUART:
DELAY:
DELAY1:
MOV AL,[SI]
OUT DX,AL
CALL DELAY
INC SI
DEC BL
JNZ SENDCHAR
JMP PRINT
MOV DX,0FF12H
OUT DX,AL
MOV CX,1000
LOOP DELAY1
RET
ORG 1200H
DB
1BH,40H,1BH,31H,31H,32H,33H,34H,35H,0DH
50
EX.NO:9
DATE:
AIM:
To display the rolling message 'HELLO' in the display.
PROCEDURE:
Connect a 50 Pin FRC Cable between 8051 Trainer Kit and the 8279
Keyboard/Display Interface card.
Now the Rolling Message HELLO would be display on 8279 keyboard/ display
interface card.
PROGRAM:
ADDRESS
1100
1103
1106
1108
110B
110C
110E
110F
1111
1112
1114
1117
OPCODE
MNEMONICS
BE 00 12
B9 0F 00
B0 10
BA 52 FF
EE
B0 CC
EE
B0 90
EE
8A 04
BA 50 FF
EE
START:MOV SI,1200
MOV CX,000F
MOV AL,10
MOV DX,FF52
OUT DX,AL
MOV AL,CC
OUT DX,AL
MOV AL,90
OUT DX,AL
LOP1: MOV AL,[SI]
MOV DX,FF50
OUT DX,AL
LOOK-UP TABLE:1200
FFH FFH FFH FFH
1204
FFH FFH FFH FFH
1208
98H 68H 7CH 7CH
120C
0CH FFH FFH FFH
51
Comments
DISPLAY FORMAT
The hex decimal data corresponding to the segments which have to glow for displaying a
character is output to port B.
DISPLAY FORMAT
Display the A character Hexvalue 88H value
D7
D6
D5
D4
D3
D2
D1
D0
dp
52
EX.NO:10
DATE:
AIM:
To interface DC motor with 8086 and to run the DC motor in forward direction
PROCEDURE:
Connect a 20 Pin FRC cable between 8086 Microprocessor J6 port (Third port) or
J9 port (First port) and the DC MOTOR/STEPPER MOTOR CARD.
PROGRAM:
ADDRESS
1100
1102
1105
1106
1108
110B
110C
110F
1111
1114
1115
1117
OPCODE
MNEMONICS
B0 80
BA 36 FF
EE
B0 05
BA 32 FF
EE
E8 02 00
EB F5
B9 FF FF
49
75 FD
C3
MOV AL,80
MOV DX,FF36
OUT DX,AL
START: MOV AL,05
MOV DX,FF32
OUT DX,AL
CALL DELAY
JMP START
DELAY: MOV CX,FFFF
LOOP: DEC CX
JNZ LOOP
RET
RESULT:
Execute the program. Now you can see that the DC motor runs in forward direction with
a delay.
53
EX.NO:11
DATE:
AIM:
To interface the stepper motor with 8086 trainer kit and to run a stepper motor at different
speed in clockwise directions.
PROCEDURE:
Connect a 20 Pin FRC cable between 8086 Microprocessor J6 port (Third port) or
J9 port (First port) and the DC MOTOR/STEPPER MOTOR CARD.
Connect USB/PS2 keyboard on 8086. Type and execute the DC Motor or Stepper
Motor program.
Now the DC Motor or the Stepper Motor is running
OPCODE
PROGRAM:
ADDRESS
1100
B0 80
1102
BA 36 FF
1105
EE
1106
BE 00 12
1109
B3 04
110B
8A 04
110D
BA 30 FF
1110
EE
1111
E8 07 00
1114
46
1115
FE CB
1117
75 F2
1119
EB EB
111B
B9 03 09
111E
49
111F
75 FD
1121
C3
ORG 1200H
1200 03
06
0C
09
MNEMONICS
MOV AL,80
MOV DX,FF36
OUT DX,AL
START : MOV SI,1200
MOV BL,04
REPEAT : MOV AL,[SI]
MOV DX,FF30
OUT DX,AL
CALL DELAY
INC SI
DEC BL
JNZ REPEAT
JMP START
DELAY: MOV CX,0903
LOOP : DEC CX
JNZ LOOP
RET
DB
END
RESULT:
Execute the program. Now we can see that the stepper motor runs in forward direction
with a delay.
54
8051
MICROCONTROLLER
55
EX NO:12
EX.NO:12.1
DATE:
AIM:
To writ an assembly language program to perform the 8-bit addition & subtraction
without carry using 8051 instruction.
APPARATUS REQUIRED:
*8051 Microcontroller trainer kit
*Power supply
PROGRAM FOR 8-BIT ADDITION WITHOUT CARRY:
ADDRESS LABEL MNEMONICS
8000
MOV DPTR,#8500H
8003
8005
MOV A,#05H
ADD A,#06H
8007
MOVX@DPTR,A
8008
LOOP
SJMP LOOP
OPCODE COMMENTS
90,85,00
Load the 16 bit data 8500h into
DPTR reg
74,05
Load the 8 bit data 05H into A reg
24,06
Add the 8 bit data 06H with
content of A reg
F0
Load the content of A reg into
memory location pointed by DPTR
80,FE
Short jump to the given address
specified by LOOP
INPUT:
DATA 1:05H
DATA 2:06H
OUTPUT:
ADDRESS
8500H
DATA
0BH
56
LOOP
MNEMONICS
CLR C
MOV
DPTR,#8500H
MOV A,#05H
ADD A,#06H
OPCODE COMENTS
C3
Clear the carry flag
90,85,00
Load the 16 bit data 8500h into
DPTR reg
74,05
Load the 8 bit data 05H into A reg
24,06
Add the 8 bit data 06H with content
of A reg
MOVX@DPTR,A F0
Load the content of A reg into
memory location pointed by DPTR
SJMP LOOP
80,FE
Short jump to the given address
specified by LOOP
INPUT:
DATA 1:05H
DATA 2:06H
OUTPUT:
ADDRESS
8500H
DATA
FFH
RESULT:
Thus the program for addition and subtraction of two 8 bit data without carry was
written using 8051 instruction and the output is obtained and verified.
57
EX.NO:12.2
DATE:
AIM:
To write an assembly language program to perform the 8-bit addition & subtraction
with carry using 8051 instruction.
APPARATUS REQUIRED:
*8051 Microcontroller trainer kit
*Power supply
PROGRAM FOR 8-BIT ADDITION WITH CARRY:
ADDRESS LABEL MNEMONICS
8000
MOV
DPTR,#8500H
8003
MOV A,#05H
8005
ADD A,#06H
8007
MOVX @DPTR,A
8008
INC DPTR
8009
800A
CLR A
ADDC A,#00H
800C
MOVX @DPTR,A
800D
SJMP LOOP
OPCODE COMMENTS
90,85,00
Load the 16 bit data 8500H into
DPTR reg
74,05
Load the 8 bit data 05H into A reg
24,06
Add the 8 bit data 06H with content
of A reg
F0
Load the content of A reg into
memory location pointed by DPTR
A3
Increment the content of DPTR by
1.
E4
Clear the content of A reg.
34,00
Add the 8-bit data 00H and
previous carry with content of A
reg.
F0
Load the content of A reg into
memory location pointed by DPTR.
80,FE
Short jump to the given address
specified by LOOP.
INPUT:
DATA 1:05H
DATA 2:06H
OUTPUT:
ADDRESS
8500H
8501H
DATA
0BH(RESULT)
00H(CARRY)
58
MNEMONICS
CLR C
MOV
DPTR,#8500H
MOV A,#05H
SUBB A,#06H
8008
MOVX @DPTR,A
8009
INC DPTR
800A
800B
CLR A
ADDC A,#00H
800D
MOVX @DPTR,A
800E
SJMP LOOP
OPCODE COMMENTS
C3
Clear the carry flag.
90,85,00
Load the 16 bit data 8500H into
DPTR reg
74,05
Load the 8 bit data 05H into A reg
94,03
Subtract the 8 bit data 06H and
previous borrow from the content
of A reg
F0
Load the content of A reg into
memory location pointed by DPTR
A3
Increment the content of DPTR by
1.
E4
Clear the content of A reg.
34,00
Add the 8-bit data 00H and
previous carry with content of A
reg.
F0
Load the content of A reg into
memory location pointed by DPTR.
80,FE
Short jump to the given address
specified by LOOP.
INPUT:
DATA 1:05H
DATA 2:06H
OUTPUT:
ADDRESS
8500H
8501H
DATA
FFH(RESULT)
01H(CARRY)
RESULT:
Thus the program for addition and subtraction of two 8 bit data with carry was written
using 8051 instruction and the output is obtained and verified.
59
EX.NO:12.4
DATE:
AIM:
To write an assembly language program to perform the 8-bit multiplication & division by
using 8051 instruction.
APPARATUS REQUIRED:
*8051 Microcontroller trainer kit
*Power supply
PROGRAM FOR 8-BIT MULTIPLICATION:
ADDRESS LABEL
8000
8002
8005
MNEMONICS
MOV A,#FBH
MOV B,#12H
MUL A,B
OPCODE
77,FB
75,F0,12
A4
8006
90,85,00
8009
MOV
DPTR,#8500H
MOVX @DPTR,A
800A
INC DPTR
A3
800B
MOV A,B
E5,F0
800D
MOVX @DPTR,A
F0
SJMP LOOP
80,FE
800E
LOOP
F0
INPUT:
DATA 1:FBH
DATA 2:12H
OUTPUT:
ADDRESS
8500H
8501H
DATA
A6H
11H
60
COMMENTS
Load the 8 bit data FBH into A reg
Load the 8 bit data 12H into B reg
Multiply the content of A reg
with content of B reg.
Load the 16 bit data 8500H into
DPTR reg
Load the content of A reg into
memory location pointed by DPTR
Increment the content of DPTR by
1.
Move the content of B reg into B
reg.
Load the content of A reg into
memory location pointed by DPTR
Short jump to the given address
specified by LOOP.
MNEMONICS
MOV A,#FBH
MOV B,#12H
DIV A,B
OPCODE
77,FB
75,F0,12
84
8006
90,85,00
8009
MOV
DPTR,#8500H
MOVX @DPTR,A
800A
INC DPTR
A3
800B
MOV A,B
E5,F0
800D
MOVX @DPTR,A
F0
SJMP LOOP
80,FE
800E
LOOP
F0
61
COMMENTS
Load the 8 bit data FBH into A reg
Load the 8 bit data 12H into B reg
Divide the content of A reg with
content of B reg.
Load the 16 bit data 8500H into
DPTR reg
Load the content of A reg into
memory location pointed by DPTR
Increment the content of DPTR by
1.
Move the content of B reg into B
reg.
Load the content of A reg into
memory location pointed by DPTR.
Short jump to the given address
specified by LOOP.
EX.NO:13
DATE:
end
RESULT:
Thus the Square and Cube program, Find 2s complement of a number is done in 8051
microcontroller
63
EX.NO:14
PROGRAM LOGICAL AND BIT MANIPULATION USING 8051
DATE:
AIM:
To write an ALP to perform logical and bit manipulation operations using 8051
microcontroller.
APPARATUS REQUIRED:
8051 microcontroller kit
ALGORITHM:
1. Initialize content of accumulator as FFH
2. Set carry flag (cy = 1).
3. AND bit 7 of accumulator with cy and store PSW format.
4. OR bit 6 of PSW and store the PSW format.
5. Set bit 5 of SCON.
6. Clear bit 1 of SCON.
7. Move SCON.1 to carry register.
8. Stop the execution of program.
64
65
66
EX.NO:15
DATE:
AIM:
To convert BCD number into ASCII by using 8051 micro controller RESOURCES
REQUIERED:
8051 microcontroller kit
Keyboard
Power supply
67
FLOWCHART
68
RESULT:
The given number is converted into ASCII using 8051 microcontroller kit.
69
S.No
Date
Description
70
Page
No.
Signature
S.No
Date
Description
71
Page
No.
Signature