-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
1/39
DEPARTMENT OF INFORMATION
TECHNOLOGY
IT6411 MICROPROCESSORS AND
MICROCONTROLLERS LAB
LAB MANUALS
FOURTH SEMESTER
REGULATION 2013
[Type the abstract of the document here. The abstract is typically a short summary of the contents of the
document. Type the abstract of the document here. The abstract is typically a short summary of the
contents of the document.]
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
2/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 2
ANNA UNIVERSITY
CHENNAI-600 025
DEPARTMENT OF INFORMATION TECHNOLOGY
YEAR / SEM : II YEAR / IV SEM REGULATION : AUC / 2013
IT6411 MICROPROCESSORS AND MICROCONTROLLERS LAB
S. No Title of Experiments Page No
8086 programs using kits and MASM
1 Basic arithmetic operationsLogical operations
2
6
2 Move a data block without overlap8086 Programs using Open source
11
13
3 Code conversion and decimal arithmetic andmatrix operation
4 Floating point operationString manipulation
Sorting and searching16
5 Password checking, Print RAM size and systemdate
6 Counters and Time delay
Peripherals and Interfacing Experiments
7 Traffic light control 17
8 Stepper motor Control 18
9 Digital clock 20
10 Keyboard, Display I/F 23
11 Printer status
12 Serial Interface and parallel interface 27
13 A/D Interface and D/A Interface and waveformgeneration
29
8051 Experiments using kits and MASM14 Basic arithmetic and logical operations 31
15 Square and cube ofprogram, Find 2s
complement of a number
16 Unpacked BCD to ASCII
STAFF-IN-CHARGE HOD/IT
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
3/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 3
EX.NO : 1 A ARITHMETIC OPERATIONS USING 8086
i.Aim:To perform arithmetic operations using 8086.
Apparatus:
1.Microprocessor kit
2.Power chord
3.Keyboard.
Two Byte Addition:
Algorithm:1.Initialize carry register CL with 00.Load AH and AL registers with MSB and LSB
of first data respectively. Load BH and BL registers with MSB and LSB of second
data.
2.Add accumulator register content with base register.
3.Check for carry flag.If carry exixts,increment carry register by one,else go to next
step.
4.Store accumulator content to 1500 and 1501 respectively.
5.Store carry register content to 1502 and stop program.
Program:Address Opcode Operand Label Mnemonics Comments
MOV CL,00
MOV
AX,0FFFEH
MOV BX,1010H
ADD AX,BX
JNC L1
INC CL
L1 MOV [1500],AXMOV [1502],CL
HLT
ii. Multi Byte Addition:
Algorithm:
1. Load SI with address of first byte of first data.
2. Load DI with address of first byte of second data.3. Clear the carry flag and initialize counter register with no.of data
bytes of data to be added.4. Add the content of memory pointed by DI with content of memory pointer by
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
4/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 4
DS:SI also with carry bit DI pointer acts as destination.
5. Update SI and DI register accordingly using DI and dec counter.6. If counter is not equal to zero,go to step 4,else go to next step.
7. Stop program.
Program
Address Opcode Operand Label Mnemonics Comments
MOV SI,2400
MOV DI,2404
CLC
MOV CL,04
L1 MOV AL,[SI]
ADC[DI],AL
INC SI
INC DI
JN2 L1
HLT
Iii. Two Byte Subtraction:
Algorithm:
1. Move 00 to CL register. Load first and second data to AX and BX.
2. Subtract AX with BXIf carry exists,increase CL count.
3. Store AX register and CL count value to memory location.
4. Stop the program.
Program:Address Opcode Operand Label Mnemonic
s
Comments
MOV
CL,00
MOV
AX,0FFFFH
MOV
BX,1010HSUBAX,BX
JNC L1
INC CL
L1; MOV[1500
],AX
MOV[1502
],CL
HLT
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
5/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 5
iv.Multibyte Subtraction:
Algorithm:
1. Load SI and DI with first and second data.
2. Clear the carry flag and initialize CL register with no.of data byte.
3. Subtract content of memory pointer by ES:DI from content of memory pointer
by ES:DI along carry bit with DI pointer acts as destination pointer.4. Update SI and DI register with carry bit DI pointer acting as decrement
counter.If counter !=0 then go to step 4,otherwise go to next step.5. Stop the program.
Program:
Address Opcode Operand Label Mnemonics Comments
MOV SI,2400
MOV
DI,2404
CLCMOV CL,04
L1 MOV AL,[SI]
SBB[DI],AL
INC SI
INC DI
DEC CL
JNZ L1
HLT
v.8 Bit Multiplication:
Algorithm:
1. Load accumulator(AL) with 1st data and BL with 2nd data.
2. Multiply and store AX content into memory.
3. Stop the program
Program:
Address Opcode Operand Label Mnemonics Comments
MOV
AL,0AAMOV
BL,0BB
MUL BL
MOV[3100],
AX
HLT
vi.16 Bit Multiplication:
Algorithm:1. Load AX with 1st data and multiply 2nd data with AX content.
2. Move MSB in DX & LSB in AX to memory and stop the program.
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
6/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 6
Program:
Address Opcode Operand Label Mnemonics Comments
MOVAX,0FFFF
MOV
BX,1010
MUL BX
MOV[2902],D
X
MOV[2900],A
X
HLT
Vii.16/8 Bit Division:
Algorithm:1. Load AX with first 16 bit
2. Get 2nd data in BL register.
3. Divide AX with BL content
4. Store AX content in memory
5. Stop the program
Program:
Address Opcode Operand Label Mnemonic
s
Comments
MOVAX,0002
MOV
BL,01
DIV BL
MOV[2300],AX
HLT
Viii.32/16 Bit Division:Algorithm:
1. Load AX with LSB of 1st data and DX with MSB first data
2. Divide DX & accumulator content with 2nd data3. Store quotient (AX) into memory
4. Store remainder(DX) into memory
5. Stop the program.
Program:
Address Opcode Operand Label Mnemonic
s
Comments
MOV
AX,6562
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
7/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 7
MOV
DX,1232
MOVCX,1F20
DIV CX
MOV
[1200],AX
MOV[1202
],DX
HLT
Result:
Thus arithmetic operations using 8086 is done and program is executed and output is
verified.
Ex.NO:1.B 8086 programs using Logical Operations
i. ONE'S COMPLEMENT OF A 16-BIT NUMBER:
AIM:
To find the one's complement of the data in register pair AX and store the
result at 1400.
Apparatus required:
1.8086 Microprocessor kit
2.Power chord
3.Keyboard.
EXAMPLE:
The example given is to find the one's complement of 1234 and store it inmemory location 1400.
Input:
Data: (AX) = 0001 0010 0011 0100 = 1234
Result: [1400] = 1110 1101 1100 1011 = EDCB
PROGRAM:
MOV AX,1234 ; word in AX register
NOT AXMOV [1400],AX ; One's complement in
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
8/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 8
; AX and memory
HLT
OBJECT CODES:
Memory Address Object Codes Mnemonics
10001001
1002
1003
1004
1005
10061007
1008
1009
100A
C7C0
34
12
F7
D0
8906
00
14
F4
MOV AX,1234
NOT AX
MOV [1400],AX
HLT
ii. MASKING OFF BITS SELECTIVELY:
AIM:
To clear 8 selected bits,the 2nd
HN and the HN in a 16 bit number.
EXAMPLE:
The 16 bit number is at location 1200 and the result is at location 1400.
Input: [1200] = FF
[1201] = FF
Result: [1400] = 0F
[1401] = 0F
PROGRAM:
MOV AX,[1200] ;data in AX
AND AX,0F0F
MOV [1400],AX ;result in 1400
HLT
OBJECT CODES:
Memory Address Object Codes Mnemonics
1000 8B MOV AX,[1200]
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
9/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 9
1001
1002
1003
1004
1005
1006
1007
10081009
100A
100B
100C
06
00
12
81
E0
0F
0F
8906
00
14
F4
AND AX,0F0F
MOV [1400],AX
HLT
iii. SETTING BITS SELECTIVELY IN A 16-BIT NUMBER:
OBJECTIVE:
To set the LN snd the 2nd
LN of a 16-Bit number in AX and store the
result at memory location 1100.
EXAMPLE:
The accumulator AX is initially cleared.Input: (AX) = 0000
Result: [1100] = 0F0F
PROGRAM:
MOV AX,0 ;clear accumulatorOR AX,0F0F ;OR with 0F0F
MOV [1100],AX ;Store result in memory
HLT
OBJECT CODES:
Memory Address Object Codes Mnemonics
1000
1001
1002
1003
1004
1005
1006
10071008
C7
C0
00
00
81
C8
0F
0F89
MOV AX,0000
OR AX,0F0F
MOV [1100],AX
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
10/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 10
1009
100A
100B
100C
06
00
11
F4 HLT
iv. SUM OF THE NUMBERS IN A WORD ARRAY:OBJECTIVE:
To obtain the sum of a 16-bit array in memory, using index register SI and store the
result in memory,
EXAMPLE:
Data in array from START =1110
[1110]=0FFF[1112]=0FFF
[1114]=0FFF
[1116]=0FFF
[1118]=0FFF
PROGRAM:MOV CX, 5 ;number of elements in CX
MOV AX, 0MOV SI, AX ;initialise SI to start of array
LOOP1 : ADD AX,START[SI]ADD SI,2 ;decrement CX and check
;if Zero
LOOP LOOP1
MOV [SUM],AX
HLT
OBJECT CODES:
Memory Address Object Codes Mnemonics
1000
10011002
1003
1004
1005
1006
10071008
1009
100A
100B
100C
C7
C105
00
C7
C0
00
0089
C6
03
06
10
MOV CX, 5
MOV AX, 00
MOV SI, AX
LOOP1 : ADD AX,[1100]
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
11/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 11
100D
100E
100F
1010
1011
1012
1013
10141015
1016
1017
1018
11
81
C6
02
00
E2
F6
8906
00
12
F4
ADD SI,2
LOOP LOOP1
MOV [1200],AX
HLT
EX.NO 3 STRING MANIPULATION OPERATIONS USING 8086
Aim:
1. To transfer a block of 10 data word from one memory to another in forward &
reverse direction
2. Block transfer in forward direction:
Algorithm
1. Move source index register with necessary offset address
2. Move destination index register with necessary offset address
3.
Load the count value in CX register4. Move string byte from source to destination address through accumulator
5. Increment the SI & DI registers
6. Decrement CX,if it is zero ,go to next step else step 4
7. Stop the program
Program
Address Opcode Operand Label Mnemonic
s
Comments
MOV
SI,1500
MOV
DI,1600
MOV
CX,0005
L1 MOV
AX,[SI]
L1 MOV
[DI],AX
INC SI
INC SI
INC DI
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
12/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 12
INC DI
L2 DEC CX
JNZ L1
HLT
Block transfer in reverse directionAlgorithm
1. Move source index register with necessary offset address2. Move destination index register with necessary offset address
3. Load the count value in CX register
4. Move content of memory pointed by source index reg to accumulator
5. Move the accumulator content to memory pointed by destination index register
6. Increment DI and decrement SI register
7. Decrement CX,if zero go to next step,else go to step 4
8.
Stop the programProgram
Address Opcode Operand Label Mnemonic
s
Comments
MOV
SI,1500
MOV
DI,1600
MOV
CX,0005L1 MOV
AX,[SI]
MOV
[DI],AX
DEC DI
DEC DI
INC SI
INC SI
DEC CXJNZ L1
HLT
Array addition
Algorithm
1. Load the counter reg CX with the number of data bytes to be added & also
clear AX.
2. Load SI reg with the starting address of the data
3.
Initialize the carry reg with zero.Add the numbers in the array pointed by SIwith content of AX along carry
4. Check for carry.If carry exists then increment the carr reg by 1 , then go to next
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
13/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 13
step
5. Update the SI content to point to the next data & decrement the CX regcount.Check for zero flag.If not equal to zero go to next step
6. Move the result in AX and carry reg to memory
7. Stop the program
Program
Address Opcode Operand Label Mnemonic
s
Comments
MOV
CX,0005
MOV
AX,0000
MOVBX,0000
MOVSI,1700
CLC
L2 ADC
AX,[SI]
JNZ L1
INC BX
L1 INC SI
INC SI
DEC CXJNZ L2
MOV[1600
],AX
MOV[1602
],BX
HLT
Even and odd number generation
1. Load count value to CX register
2.
Initialize DI register to a address & clear AL reg3. Load accumulator with 00 for even number generation and 01 for odd number
generation4. Move the content of accumulator to memory location pointed by DI
5. Add 02 to accumulator . Increment DI register
6. Decrement CX reg . If zero go to next step,else step 4
7. Stop the program
Even number generation
Address Opcode Operand Label Mnemonic
s
Comments
MOV
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
14/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 14
CX,0005
MOV
DI,1500
MOV
AL,00
L1 MOV
[DI],AL
ADD
AL,02
INC DI
DEC CX
JNZ L1
HLT
Odd number generation:Address Opcode Operand Label Mnemonics Comments
MOV
CX,0005
MOV
DI,1500
MOV
AL,01
L1 MOV
[DI],ALADD AL,02
INC DI
DEC CX
JNZ L1
HLT
Arithmetic operations using 8086 simulator(emuOpen source)
Aim:
To perform arithmetic operations using 8086.
Apparatus Required:
1.PC with 8086 emulator
Program: 16 bit addition
ORG 1000hMov ax,0002h
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
15/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 15
Mov bx,0013h
Mov cx,0000hAdd ax,bx
Jnc l1
Inc cxMov si,1400h
Mov[si],ax
Add si,0002hMov [si],cx
Hlt
SAMPLE DATAS:ADDITION
INPUT OUTPUT
Address/Reg Data Address Data
Ax
BxCX
004E
00FF0000
Ax
BxCX
01 4D
OOFFOOOO
16 bit subtraction
Mov ax,0005hMov bx,0003h
Mov cx,0000hsub ax,bx
Jnc l1
Inc cxMov si,1400h
Mov[si],ax
Add si,0002hMov [si],cx
Hlt
SAMPLE DATAS:SUBTRACTION
INPUT OUTPUT
Address/Reg Data Address Data
Ax
Bx
1020
20 30
Ax
Bx
EFF0
2030
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
16/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 16
CX 0000 CX 0001
16 bit Multiplication
Mov ax,1020hMov bx,2020h
Mov cx,0000h
Mov si,1400hMul bx
Mov [si],ax
Add si,0002hMov[si],cx
hlt
SAMPLE DATAS:MULTIPLICATION
INPUT OUTPUT
Address/Reg Data Address Data
AxBx
CX
102020 20
0000
AxBx
CX
DX
04002020
0000
0206
16 bit divisionMov ax,1020h
Mov bx,2020h
Mov cx,0000h
Mov si,1400
Div bx
Mov[si],axAdd si,0002h
Mov[si],cx
hlt
SAMPLE DATAS:DIVISION
INPUT OUTPUT
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
17/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 17
Address/Reg Data Address Data
Ax
Bx
CX
0025
0005
0000
Ax
Bx
CX
DX
0007
2025
0000
0002
SORTING IN 8086:
org 1000h
mov ax,0505hL3:mov bx,1400h
L2:mov ax,[bx]cmp ax,0002h[bx]jc l1
xchg ax,0002[bx]
mov [bx],ax
L1:add bx,0002h
dec di
jnc L2
mov cl,chdec ch
jmp L3hlt
BLOCK TRANSFER [Forward ] :
mov si,1400h
mov di,1500h
mov cx,0005hL1:mov ax,[si]
mov [di],ax
add si,0002hadd di,0002h
dec cx
jnz l1mov [si],1500h
mov [si],ax
hlt
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
18/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 18
BLOCK TRANSFER [Reverse] :
mov si,1500hmov di,1400h
mov cx,0005h
L1:mov ax,[si]mov [di],ax
add di,0002h
add si,0002hdec cx
jnz l1
mov [si],1400hmov [si],ax
hlt
Ex.No .7 TRAFFIC LIGHT CONTROLLER
AIM:
To write a Program for Microprocessor based Traffic light system using
8086LCD mnemonics
APPARATUS REQUIRED:
8086 MP kit, 50 core cable,Traffic light controller interface
Procedure:
Enter the program starting from location 1000. Execute the program
The traffc light controller Led glows as per the given control word.Direction can be varied by entering the data in the look uptable in the reverse order.
Memory Address Object Codes Mnemonics
1000
1003
1007
100A
100C
100E
1010
10121016
C6 C0 80
E6 26
C7 C3 73 10
C7 C6 7F 10
E8 33 00
8A 04
E6 20
E8 4D 0046
MOV AL,80H
MOV CL,04
MOV AL,[DI]
MOV C0,AL
MOV DX,1010
DEC DX
JNZ 100F
INC DILOOP 1007
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
19/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 19
1017
1019
101A
101C
101F
1020
43
E8 27 00
8A 04
E6 22
E8 41 00
46
43
E8 1B 00
JMP 1000
TABLE 09 05 06 0A
Ex.No:8
Stepper motor Interface with 8086AIM:
To run a stepper motor at different speed.
APPARATUS REQUIRED:
8086 MP kit, RS 232 cable, Stepper motor interface
Procedure:
Enter the program starting from location 1000. Execute the program
The stepper motor rotates. Speed can be varied by varying the count at dx register pair.
Direction can be varied by entering the data in the lookuptable in the reverse order.
PROGRAM
Memory Address Object Codes Mnemonics
1000
1004
10071009
100B
100F1010
1012
1013
1015
1018
C7 C7 18 10
C6 C1 04
8A 05E6 C0
C7 C2 1010
4A75 FD
47
E2 F2
E9 E8 FF
09 05 06 0A
MOV DI,1018
MOV CL,04
MOV AL,[DI]MOV C0,AL
MOV DX,1010
DEC DXJNZ 100F
INC DI
LOOP 1007
JMP 1000
TABLE 09 05 06 0A
AIM:To run a stepper motor for required angle within 360 which is equivalent to 256
steps
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
20/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 20
Procedure:
Enter the program and execute it
By converting the requiring steps in decimal to hex and entering the hex data at 1001 the
motor rotates for so much steps and stops.
PROGRAM
Memory Address Object Codes Mnemonics
1000
1003
1007
100A
100C
100E1010
1012
1016
1017
1019
101A
101C
101F
1020
C7 C3 45
C7 C7 20 10
C6 C1 04
8A 05
E6 C0
FE CB74 OD
C7 C2 10 10
4A
75 FD
47
E2 EE
E9 E4 FF
F4
09 05 06 0A
MOV DI,1018
MOV CL,04
MOV AL,[DI]
MOV C0,AL
MOV DX,1010
DEC DXJNZ 100F
INC DI
LOOP 1007
JMP 1000
TABLE 09 05 06 0A
AIM: To run a stepper motor in both forward and reverse direction with delay
APPARATUS REQUIRED:
8086 MP kit, RS 232 cable, Stepper motor interface
Procedure:
Enter the program and execute it after connecting the stepper motor in port1. Execute the
program. Now stepper motor runs in both forward and reverse direction continuously with a
delay
By converting the requiring steps in decimal to hex and entering the hex data at 1001 the
motor rotates for so much steps and stops.
PROGRAM
Memory Address Object Codes Mnemonics
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
21/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 21
1000
1003
1007
100A
100C
100E
1011
10141018
101B
101D
101F
1022
1025
1028102A102C
1030
1031
1033
1034
1036
1037
103B103C
103E
103F
1043
C6 C3 20
C7 C7 3F10
E8 1B 00
FE CB
75 F5
E8 2A 00
C6 C3 20
C7 C7 43 10E8 0A 00
FE CB
75 F5
E8 19 00
E9 DB FF
C6 C1 04
8A 05E6 C0
C7 C2 10 10
4A 75 FD
47
E2 F2
C3
C7 C2 FF FF
4A
75 FDC3
09 05 06 0A
0A 06 05 09
MOV BL,20
MOV DI,103F
CALL 1025
DEC BL
JNZ 1003
CALL 103B
MOV BL,20
MOV DI,1043CALL 1025
DEC BL
JNZ 1014
CALL 103B
JMP 1000
MOV CL,04
MOV AL,[DI]OUT C0,AL
MOV DX,1010
DEC DX
JNZ 1030
INC DI
LOOP 1028
RET
MOV DX,0FFFF
DEC DXJNZ 103B
RET
FORWARD DATA
REVERSE DATA
RESULT:
EX.NO:9
DIGITAL CLOCKAim
To generate a digital clock in 8086 kit.
Store time value in memory location 1500-SECONDS
1501-MINUTES
1502-HOURS
Address Opcode Label Mnemonics Comments
1000 E8 00 60 START CALL
CONVERT
1003 E8 00 51 CALLDISPLAY
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
22/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 22
1006 B0 B0 DELAY: MOV
AL,0B0H
1008 E6 16 OUT 16H,AL
100A B1 07 MOV CL,07H
100C B0 88 S2: MOV AL,88H
100E E6 14 OUT 14H,AL
1010 B0 80 MOV A;,80H
1012 E6 14 OUT 14H,AL
1014 90 S1: NOP
1015 90 NOP
1016 90 NOP
1017 90 NOP
1018 E4 14 IN AL,14H
101A 8A D0 MOV DL,AL
101C E4 14 IN AL,14H
101E 0A C2 OR AL,DL
1020 75 F2 JNZ S1
1022 FE C9 DEC CL
1024 75 E6 JNZ S2
1026 BE 15 00 MOV
SI,1500H
1029 8A 04 MOV AL,[SI]
102B FE C0 INC AL
102D 88 04 MOV [SI],AL
102F 3C 3C CMP AL,3CH
1031 75 CD JNZ START
1033 B0 00 MOV AL,00H
1035 88 04 MOV [SI],AL
1037 46 INC SI
1038 8A 04 MOV AL,[SI]
103A FE C0 INC AL
103C 88 04 MOV [SI],AL
103E 3C 3C CMP AL,3CH
1040 75 BE JNZ START
1042 B0 00 MOV AL,0
1044 88 04 MOV [SI],AL
1046 46 INC SI
1047 8A 04 MOV AL,[SI]
1049 FE C0 INC AL
104B 88 04 MOV [SI],AL
104D 3C 18 CMP AL,18H
104F 75 AF JNZ START
1051 B0 00 MOV AL,0
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
23/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 23
1053 88 04 MOV [SI],AL
1055 EB A9 JMP START
1057 B4 06 DISPLAY: MOV
AH,06H1059 BA 1600 MOV
DX,1600H
105C B5 01 MOV
CH,01H
105E B1 00 MOV CL,0H
1060 CD 05 INT 5
1062 C3 RET
1063 BE 1500 CONVERT: MOVSI,1500H
1066 BB 1608 MOV
BX,1608H
1069 B0 24 MOV AL,24H
106B 88 07 MOV[BX],AL
106D 8A 04 MOV AL[SI]
;SECONDS
106F B4 00 MOV AH,01071 B6 0A MOV
DH,0AH
1073 F6 F6 DIV DH
1075 80 C4 30 ADD AH,30H
1078 4B DEC BX
1079 88 27 MOV[BX],AL
107B 4B DEC BX
107C 04 30 ADD L,30H107E 88 07 MOV
[BX]AL
1080 4B DEC BX
1081 B0 3A MOV
AL,3AH
1083 88 07 MOV
[BX],AL
1085 4B DEC BX
1086 46 INC SI
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
24/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 24
;MINUTES
1087 8A 04 MOV AL,[SI]
1089 B4 00 MOV AH,0
108B B6 0A MOV
DH,0AH
108D F6 F6 DIV DH
108F 80 C4 30 ADD AH,30H
1092 88 27 MOV
[BX],AH
1094 4B DEC BX
1095 04 30 ADD AL,30H
1097 88 07 MOV
[BX],AL
1099 4B DEC BX
109A B0 3A MOV
AL,3AH
109C 88 07 MOV
[BX],AL
109E 4B DEC BX
109F 46 INC SI
;HOURS
10A0 8A 04 MOV AL,[SI]
10A2 B4 00 MOV AH,010A4 B6 0A MOV
DH,0AH
10A6 F6 F6 DIV DH
10A8 80 C4 30 ADD AH,30H
10AB 88 27 MOV
[BX],AH
10AD 4B DEC BX
10AE 04 30 ADD AL,30H
10B0 88 07 MOV[BX],AL
10B2 C3 RET
10B3 E4 02 GETC: IN AL,02H
10B5 24 FF AND
AL,0FFH
10B7 3C F0 CMP
AL,0F0H
10B9 75 F8 JNE GETCEND
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
25/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 25
Result:
EX.NO:10 INTERFACING & PROGRAMMING WITH 8279Aim
A.To display a letter in display interfacing with 8279
B.To roll the display in 8279 using 8086
i)TO DISPLAY A IN THE FIRST DIGIT:
Program
Address Opcode
Operand
Label Mnemonics Comments
1000 B0 00 MOV AL,00
1002 E6 C2 OUT C2,AL
1004 B0 CC MOV
AL,0CC
1006 E6 C2 OUT C2,AL
1008 B0 90 MOV AL,90
100A E6 C2 OUT C2,AL
100C B0 88 MOV AL,88
100E E6 C0 OUT C0,AL
1010 B0 FF MOV AL,0FF
1012 B9 05 00 MOVCX,0005
1015 E6 C0 NEXT OUT C0,AL
1017 E2 FC LOOP NEXT
1019 F4 HLT
II) ROLLING DISPLAY
PROGRAM:
Address Opcode
Operand
Label Mnemonics Comments
1000 BE 00 12 START MOV SI,1200
1003 B9 0F MOV
CX,000F
1006 B0 10 MOV AL,10
1008 E6 C2 OUT C2,AL
100A B0 CC MOV AL,CC
100C B0 90 OUT C2,AL
100E E6 C2 MOV AL,90
1010 E6 C2 OUT C2,AL
1012 8A 04 NEXT MOV AL,[SI]
1014 E6 C0 OUT C0,AL
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
26/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 26
1016 E8 E7 04 CALL
DELAY
1019 46 INC SI
101A E2 F6 LOOP NEXT
101C EB E2 JMP START
1500 BA,FF,A0 DELAY MOV
DX,A0FF
1503 4A LOOP1 DEC DX
1504 74,FD JNZ LOOP1
1506 C3 RET
1200 FF,FF,FF,FF
FF,FF,FF,FF
98,68,7C,C8FF,1C,29,FF
Ex.No :12a. Serial Interface (8251) Interface with 8086AIM:
To send the data serially to another serial port.
APPARATUS REQUIRED:
8086 MP kit, RS 232 cable
Procedure:
Connect the two serial ports with RS232C Cable. First make the receiver ready and
Then execute the program at transmitter end.
EXAMPLE:
Data in Transmitter :41H
Receiver [1500]:41H
OBJECT CODES:TRANSMITTER END
Memory Address Object Codes Mnemonics
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
27/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 27
1000
1002
1004
1006
1008
100A
100C
100E1010
1012
1014
1016
1018
101A
101C101E
B0 36
E6 CE
B0 10
E6 C8
B0 00
E6 C8
B0 4E
E6 C2B0 37
E6 C2
E4 C2
24 04
74 FA
B0 41
E6 C0CD 02
MOV AL,36
OUT CE,AL
MOV AL,10
OUT C8,AL
MOV AL,00
OUT C8,AL
MOV AL,4E
OUT C2,ALMOV AL,37
OUT C2,AL
LOOP1: IN AL,C2
AND AL,04
JZ LOOP1
MOV AL,41
OUT C0,ALINT2
Receiver end
Memory Address Object Codes Mnemonics
1200
12021204
1206
1208120A
120C
120E
1210
12121214
1216
1218
121A121C
B0 36
E6 CEB0 10
E6 C8
B0 00E6 C8
B0 4E
E6 C2
B0 37
E6 C2E4 C2
24 04
74 FA
B0 41E6 C0
MOV AL,36
OUT CE,ALMOV AL,10
OUT C8,AL
MOV AL,00OUT C8,AL
MOV AL,4E
OUT C2,AL
MOV AL,37
OUT C2,ALLOOP 2: IN AL,C2
AND AL,02
JZ LOOP2
IN AL,C0MOV BX,1500
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
28/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 28
121E CD 02 MOV [BX],AL
INT2
RESULT:
______________________________________
Ex.No:12 b.
Parallel Interface(8255) Interface with 8086AIM:
To initialize Port A as an input port in mode -0.
APPARATUS REQUIRED:
8086 MP kit, 50 core cable, 8255 kit
Procedure:
1. Connect the 8086 kit with 8255 using core cable.
2. Enter the program starting from user RAM address 1000H set a known data in SPDT switch
3.
Type and execute the program in 8086 kit
4. Verify the result at 1500H as data data given through SPDT switch
OBJECT CODES:To initialize PORT A as input port in mode 0.
Memory Address Object Codes Mnemonics
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
29/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 29
1000
1003
1005
1007
1009
100B
BE 00
B0 90
E6 C6
E4 C0
88 04
F4
MOV SI,1500H
MOV AL,90H
OUT C6,AL
IN AL,C0
MOV [SI],AL
HLT
AIM:To initialize Port A as an input port and port B as output port in mode 0
APPARATUS REQUIRED:
8086 MP kit, 50 core cable, 8255 kit
Procedure:
1. Connect the 8086 kit with 8255 using core cable.
5. Set a known data in SPDT switch
6. Type and execute the program in 8086 kit
7. Verify visually that the data output at the LEDs is same as that set by the SPDT switch
settings
OBJECT CODES:To initialize PORT A as input port and port B as output port in mode-0
Memory Address Object Codes Mnemonics
1000
1003
1005
1007
1009
100B
BE 00
B0 90
E6 C6
E4 C0
88 04
F4
ORG 1000H
MOV AL,90H
OUT C6,AL
IN AL,C0
OUT C2,AL
HLT
AIM:To initialize Port C as an Output port and port B in mode 0 and to explain the BIT
set and reset features of PORT C
APPARATUS REQUIRED:
8086 MP kit, 50 core cable, 8255 kit
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
30/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 30
PROCEDURE:
1. Connect the 8086 kit with 8255 using core cable.
8.
Enter the program starting from user RAM address 1000H
9.
Type and execute the program in 8086 kit
10.
Verify the result at LEDS after changing the datas
OBJECT CODES:To initialize PORT A as input port and port B as output port in mode-0
Memory Address Object Codes Mnemonics
1000
10021004
10061008
100A
100B
100C
B0 80
E6 C6B0 01
E6 C4B0 07
E6 C6
F4
ORG 1000H
MOV AL,80OUT C6,AL
MOV AL,01OUT C4,AL
MOV AL,07
OUT C6,AL
HLT
Ex.No 13.i. INTERFACING & PROGRAMMING WITH ADC
Aim:
To design an ADC converting using 8086
Algorithm:
1. Select the channel and insert the ALE by sending corresponding data C8
2. Assert the SOC(Start of Conversion) signal high and provide some delay
3. After the delay make the SOC signal low and wait for the EOC(End of
Conversion)
4.
Read the converted digital data and stores it in the memory location.Procedure:
Place jumper J2 in A position
Place jumper J5 in A position
Enter and execute the program
Vary the analog input (using trimpot ) and verify the digital data displayed with
that data stored in memory location 1100H
Program:
Address Opcode/Oper
and
Label Mnemonics Comments
1000 C6 C0 10 MOV AL,10
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
31/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 31
1003 E6 C8 OUT C8,AL
1005 C6 C0 18 MOV AL,18
1008 E8 C8 OUT C8,AL
100A E6 C0 01 MOV AL,01
100D E6 D0 OUT D0,AL
100F C6 C0 00 MOV AL,00
1012 C6 C0 00 MOV AL,00
1015 C6 C0 00 MOV AL,00
1018 C6 C0 00 MOV AL,00
101B E6 D0 OUT D0,AL
101D E4 D8 LOOP IN AL,D8
101F 80 E0 01 AND AL,01
1022 80 E0 01 CMP AL,01
1025 75 F6 JNZ LOOP
1027 E4 C0 IN AL,C0H
1029 C7 C3 00 11 MOV
BX,1100
102D 88 07 MOV
[BX],AL
102F F4 HLT
Result:
Ex.No 13.ii. INTERFACING & PROGRAMMING WITH DACAim
To generate the square wave at the output of DAC 2.
Algorithm
1. Initialize AL and move 00 to AL
2. The accumualator content of AL is then sent to C8
3. After calling 1010 the content of FF is moved to accumulator content AL
4. Again the content of AL is sent to C8 and 1010 is called
5. The 05FF is moved to the CX and looped the content to1013
6.
Return the programProgram
Address Opcode Mnemonics Comments
1000 C6 C0 00 MOV AL,00
1002 E6 C8 OUT C8,AL
1004 E8 09 00 CALL 1010
1007 B0 FF MOV AL,FF
1009 E6 C8 OUT C8,AL
100B E8 02 00 CALL 1010
100E EB F0 JMP 1000
1010 B FF 05 MOV CX,05FF
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
32/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 32
1013 E2 FE LOOP 1013
1015 C3 RET
2.AIM: To create a saw tooth wave at the output of DAC
Algorithm:
1.
Initialize AL and move the first data 00 to AL2. After moving to AL,the accumulator content of AL is sent to c0
3. The accumulator content of AL is ncremented by 1
4. After incrementing ,if it is non zero ,jump to 1002
5. After checking for non zero , jump to 1000
Program:
Address Opcode Label Mnemonics Comments
1000 B0 00 L2 MOV AL,00
1002 E6 C0 L1 OUT C8,AL
1004 FE C0 INC AL1006 75 FA JNZ L1
1008 EB F6 JMP L2
3.Aim:
To generate the triangular waveform at DAC 2 output
Algorithm
1. Initialize BL and move 00 to BL2. Move the content of BL to AL as its content
3.
The content moved to accumulator content AL is then sent to C84. The content of BL is incremented by 1
5. If the data is m=non zero , then jump to STEP2
6. Move the content of FF to BL & then to AL
7. After moving content to AL,it is sent to C88. Decrement BL by 1
9. If it is non zero , then jump on to 100C
10.Jump to step 1
Program
Address Opcode Label Mnemonics Comments1000 B3 00 L2 MOV BL,00
1002 88 D8 MOV AL,BL
1004 E6 C8 OUT C8,AL
1006 FE C3 INC BL
1008 75 F8 JNZ 1002
100A B3 FF MOV BL,FF
100C 88 D8 L1 MOV AL,BL
100E E6 C8 OUT C8,AL
1010 FE CB DEC BL1012 75F8 JNZ L1
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
33/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 33
1014 EB EA JMP L2 JUMP TO L2
EX.NO 14 ARITHMETIC OPERATIONS USIGN 8051AIM
To write an ALP to perform
Add 2 given 8 bit numbers
Subtract 2 given 8 bit numbers
Multiply 2 8 bit numbers
Divide 2 8 bit numbers
Array addition
APPARATUS REQUIRED
1.8051 Microprocessor kit2.Eliminator
Algorithm
8 Bit Addition
1.Load the first data into accumulator & 2nd data in RO register.
2.Initialize the carry register(Rl) with OoH and initialize the data pointer with
address of the result location.
3.Add the accumulator content with the second data.
4.Check for carry flag if carry exits then increment carry register by one otherwise
5. go to next step.
6.Store the accumulator and Rl content into memory whose address pointed by
data pointer.
7.Stop the program.
Program
Address Opcodes Mnemonics Comments
MOV R1,#00H
MOV A,#FEH
MOV R0,#10H
MOV DPTR,#4500
ADD A,R0
JNC L1
INC R1
L1 MOVX @DPTR,A
INC DPTR
MOV A,R1
MOVX @DPTR,A
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
34/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 34
L2 SJMP L2
8 BIT SUBTRACTION
ALGORTITHM
1.Load the first data into accumulator & 2nd data in r0 register
2.Initialize the carry register (R1) with 00H and initialize the data pointer withaddress of the result location
3.Subtract the second data from accumulator content
4.Check for carry flag if carry exists then increment carry register by one by one
otherwise go to next step
5.Store the accumulator and R1 content into memory whose address pointed by datapointer
6.Stop the program
Address Opcode Operand Label Mnemonics CommentsMOV R1,#00H
MOV A,#FEH
MOV R0,#10H
MOV DPTR,#4500
SUB A,R0
JNC L1
INC R1
L1 MOVX @DPTR,A
INC DPTRMOV A,R1
MOVX @DPTR,A
L2 SJMP L2
8 BIT MULTIPLICATION
ALGORITHM
1. Load the accumulator and B register with first and second data
2. Multiply the B register with content of A register
3. Initialize the data pointer with address of the result location
4.
Store the accumulator content into the memory location pointed bythe data pointer and then increment data pointer by one
5. Move the B register content to A
6. Store A's content into memory location pointed by DPTR
7. Stop the program
Program
Address Opcode Operand Label Mnemonics Comments
MOV A,#05H
MOV B,#03HMOV DPTR,#4500
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
35/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 35
MUL A,B
MOVX @DPTR,A
INC DPTR
MOV A,B
MOVX @DPTR,A
L2 SJMP L2
DIVISION OF 8 BIT NUMBERS
ALGORITHM
1. Load accumulator and B register with divided and divisor data
respactively
2. Divide the accumulator content by the content of B register
3. Initialize the data pointer with the address of the result location
4. Store the accumulator content into the memory location pointed by
the pointer and then increment the data pointer by one5. Move the B register content to the accumulator
6. Store the accumulator content into the memory location pointed
out by the data pointer7. Stop the program
Program
Address Opcode Operand Label Mnemonics Comments
MOV A,#05HMOV B,#03H
MOV DPTR,#4500
DIV A,B
MOVX @DPTR,A
INC DPTR
MOV A,B
MOVX @DPTR,A
L1 SJMP L1
8 BIT ARRAY ADDITION
ALGORITHM1. Initialize the data pointer with the starting address of the source
array , also initialize the countert (R0) with number of bytes going
to be added
2. Initialaize the sum register (R2) and carry register (R1) with 00H3. Load accumulator with data byte pointed by the data pointer
4. Add the accumulator content with content of sum register(B) and
store the result in the same sum register
5.
Check for carry flag status if carry is set,then incrementcarry(R1)by one,else go to next step
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
36/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 36
6. Increment tha data pointer by one to point to the next data byte
7. Decrement the count register (R0) by one and check whether thedecremented value equal to zero or not,if not go to step 4 else go
to next step
8. Store the content of sum register(B) and carry (R1) into the 2
consecutive memory locations on pointed by data pointer9. Stop the program
Program:Array addition
Address Opcode Operand Label Mnemonics Comments
MOV DPTR,#4700
MOV R0,#05H
MOV R2,#00H
MOV R1,#00H
L2 MOVX A,@DPTR
ADD A,R2MOV R2,A
JNC L1
INC R1
L1 INC DPTR
DJNZ R0,L2
MOV A,R2
MOV @DPTR,A
INC DPTR
MOV A,R1MOVX @DPTR,A
L3 SJMP L3
Result
EX.NO 14. LOGICAL AND BIT MANIPULATION IN 8051
(B) i LOGICAL OPERATORS
AIM:
To perform logical & but manipulation in 8051ALOGRITHM
1. Get 1stbyte in R1
2. Get 2nd
operand in R2
3. Move R1 to Accumulator
4. And the Accumulator with R2
5. Move the content of the accumulator to R0.
6. Move R1 to Accumulator
7. Or the Accumulator with R2
8.
Move Accumulator content to R39. Move R1 to Accumulator
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
37/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 37
10.Take compliment for the Accumulator content
11.Move R4 to Accumulator
Program:
Address Opcode Operand Label Mnemonics Comments
MOV R1,#20H First BYTE
MOV R2 #10H Second BYTE
MOV A,R1 ANDING
R0=R1 AND R2ANL A, R2
MOV R0, A
MOV A,R1 ORING
R3=R1 OR R2ORL A, R2
MOV R3,A
MOV A, R1 NEGATION
R4=~R1CPL A
MOV R4,A
MOV A,R1 XORING
R5=R1 XOR R2XRL A,R2
MOV R5,A
LCALL 0003H
11. (B)ii. 8051HEXADECIMAL TO DECIMAL CONVERSION
AIM:
To perform hexadecimal to decimal conversionALGORITHM:
1.Load the number to be converted into the accumulator
2.If the number is less than 100(64H), go to next step; otherwise, subtract
100 (64H) repeatedly until the remainder is less than 100(64H). Have thecount (100s value) in separate register which is the carry.
3.If the number is less than 10 (0AH), go to next step; otherwise, subtract
10 (0AH) repeatedly until the remainder is less than 10(0AH). Have thecount (tens value) in separate register.
4.The accumulator now has the units5.Multiply the tens value by 10 and add it with the units. 6.Store the result and carry in the specified memory location.
Address Opcode Operand Label Mnemonics Comments
MOV DPTR, #4500
MOVX A, @DPTR
MOV B, #64
DIV A, B
MOV DPTR, #4501
MOV @DPTR, AMOV A,B
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
38/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in
IT Dept/KLNCE 38
MOV B, #0A
DIV A, B
INC DPTR
MOVX @DPTR, A
INC DPTR
MOV A,B
MOVX @DPTR,A
HLT: SJMP HLT
Result:
The given hexadecimal number is converted into decimal number
11.(b)iii. 8051DECIMAL TO HEXADECIMAL CONVERSION
AIM:
To perform decimal to hexadecimal conversion
ALGORITHM:1.Load the number to be converted in the accumulator
2.Separate the higher order digit from lower order.
3.Multiply the higher order digit by 10 and add it with the lower order digit
4.Store the result in the specified memory location
Address Opcode Operand Label Mnemonics Comments
MOV DPTR, #4500
MOVX A, @DPTR
MOV B, #0AMUL A,B
MOV B, A
INC DPTR
MOVX A ,@DPTR
ADD A,B
INC DPTR
MOVX @DPTR, A
MOV DPTR, #4500
MOVX A, @DPTRHLT: SJMP HLT
RESULT:The given decimal number is converted to hexadecimal number
-
7/25/2019 MICRO PROCESSOR AND MICRO CONTROLLER LAB MANUAL
39/39
cseitquesions.blogspot.in| cseitquesions.blogspot.in|cseitquesions.blogspot.in