Vous êtes sur la page 1sur 9

BHILAI INSTITUTE OF TECHNOLOGY, DURG (C.G.

)
(SETH BALKRISHAN MEMORIAL)
BHILAI HOUSE, G.E. ROAD, DURG (C.G.)-491001
Department of Electronics & Telecommunication
Engineering
B.E 7th Sem

Sub Code & Name :328713(28)Microcontroller &


Roll No: 7,8,9
Embedded Systems Lab.

Experiment No: 01
Date: 13 July. 2010
Aim: To add two 16bit RAM variables with carry and the result is to be stored in R0,R1 pair
Requirements: 8051IDE Software, Sim8051 Software, PC.

Program:
MOV A,0DH
ADD A,14H
MOV R1,A
MOV A,0EH
ADDC A,15H
MOV R0,A
END

K.Uma Submission Date:


(Prof. Incharge)
BHILAI INSTITUTE OF TECHNOLOGY, DURG (C.G.)
(SETH BALKRISHAN MEMORIAL)
BHILAI HOUSE, G.E. ROAD, DURG (C.G.)-491001
Department of Electronics & Telecommunication
Engineering
B.E 7th Sem

Sub Code & Name :328713(28)Microcontroller &


Roll No: 7,8,9
Embedded Systems Lab.

Program and Source Code:


Address Hex object code Mnemonics Comments

Opcode Operand

0000 E5 0D MOV A,0DH Move the data from DRAM


location 0DH to the accumulator
0002 25 14 ADD A, 14H Add the content of accumulator
with DRAM location 14H
0004 F9 MOV R1,A Move the content of accumulator
to the register R1
0005 E5 0E MOV A,0EH Move the content of DRAM
location 0EH the accumulator

0007 35 15 ADDC A,15H Add the content of accumulator


with carry to DRAM location
15H

0009 F8 MOV R0,A Move the content of accumulator


to the register R0

END End the program

Result:
INPUT IN DRAM:
MEMORY DATA
0E0DH 3412H
1514H 7856H

OUTPUT
R0 = 112H R1 = 68H

K.Uma Submission Date:


(Prof. Incharge)
BHILAI INSTITUTE OF TECHNOLOGY, DURG (C.G.)
(SETH BALKRISHAN MEMORIAL)
BHILAI HOUSE, G.E. ROAD, DURG (C.G.)-491001
Department of Electronics & Telecommunication
Engineering
B.E 7th Sem

Sub Code & Name :328713(28)Microcontroller &


Roll No: 7,8,9
Embedded Systems Lab.

. .
. .
.

Experiment No: 08
Date: 9th Mar. 2009
Aim: Write an assembly language program to solve the given arithmetic equation ∑ X2i , where
X is the 8bit unsigned no present in the memory location 30h onwards put the result in the
memory location 51h-50h.

Requirements: 8051IDE Software, Sim8051 Software, PC.

Program:
MOV R2,#10

K.Uma Submission Date:


(Prof. Incharge)
BHILAI INSTITUTE OF TECHNOLOGY, DURG (C.G.)
(SETH BALKRISHAN MEMORIAL)
BHILAI HOUSE, G.E. ROAD, DURG (C.G.)-491001
Department of Electronics & Telecommunication
Engineering
B.E 7th Sem

Sub Code & Name :328713(28)Microcontroller &


Roll No: 7,8,9
Embedded Systems Lab.

MOV R0,#30H
CLR A
MOV R7,#00H
MOV R3,#00H
L2: MOV A,@R0
MOV B,A
MUL AB
ADD A,R7
JNC L3
INC R3
L3: MOV R7,A
INC R0
DJNZ R2,L2
MOV 50H,R7
MOV 51H,R3
L1: SJMP L1
Program and Source Code:
Addre Hex object code Mnemonics Comments
ss
Opcode Operan
d

0000 7A 0A MOV R2,#10 Move the direct data to


Reg. R2
0002 78 30 MOV R0,#30 Move the direct data to
H Reg. R0

K.Uma Submission Date:


(Prof. Incharge)
BHILAI INSTITUTE OF TECHNOLOGY, DURG (C.G.)
(SETH BALKRISHAN MEMORIAL)
BHILAI HOUSE, G.E. ROAD, DURG (C.G.)-491001
Department of Electronics & Telecommunication
Engineering
B.E 7th Sem

Sub Code & Name :328713(28)Microcontroller &


Roll No: 7,8,9
Embedded Systems Lab.

0004 E4 CLR A Clear the content of Acc.

0005 7F 00 MOV R7,#00 Move the direct data to


H Reg. R7

0007 7B 00 MOV R3,#00 Move the direct data to


H Reg. R3

0009 E6 MOV A,@R0 Move the content of


memory location pointed
by R0 to the Acc.

000A F5 F0 MOV B,A Move the content of Acc.


To Reg.B

000C A4 MUL AB Multiply the content of Reg.


B with the content of Acc.

000D 2F ADD A,R7 Add the content of Reg. R7


with Acc.

000E 50 01 JNC 0011 Jump on no carry

0010 OB INC R3 Increment content of Reg.


R3

0011 FF MOV R7,A Move the content of Acc. to


R7

0012 08 INC R0 Increment content of Reg.


R3

0013 DA F4 DJNZ R2,0009 Decrement the content of


Reg.R2 and jump if no zero

0015 8F 50 MOV 50H,R7 Move the content of Reg.

K.Uma Submission Date:


(Prof. Incharge)
BHILAI INSTITUTE OF TECHNOLOGY, DURG (C.G.)
(SETH BALKRISHAN MEMORIAL)
BHILAI HOUSE, G.E. ROAD, DURG (C.G.)-491001
Department of Electronics & Telecommunication
Engineering
B.E 7th Sem

Sub Code & Name :328713(28)Microcontroller &


Roll No: 7,8,9
Embedded Systems Lab.

R7 to memory location 50h.

0017 8B 51 MOV 51H,R3 Move the content of Reg.


R3 to memory location 51h.

0019 80 FE SJMP 0019 End

Result:
MEMORY LOCATION
30H=00 OUTPUT
31H=01 MEMORY LOCATION:
32H=04 50H=1DH
. 51H=01H
.
..
39H=51H
Experiment No: 09
Date: 09 March 2009
Aim: Write an assembly language program to find largest byte from the 10 number present in the
memory location from 30H onward , put the result & show at the end of the block.

Requirements: 8051IDE Software, Sim8051 Software, PC.

K.Uma Submission Date:


(Prof. Incharge)
BHILAI INSTITUTE OF TECHNOLOGY, DURG (C.G.)
(SETH BALKRISHAN MEMORIAL)
BHILAI HOUSE, G.E. ROAD, DURG (C.G.)-491001
Department of Electronics & Telecommunication
Engineering
B.E 7th Sem

Sub Code & Name :328713(28)Microcontroller &


Roll No: 7,8,9
Embedded Systems Lab.

Program:
MOV R3,#10
MOV R0,#30H
CLR A
MOV A,@R0
L3: INC R0
MOV 3AH,@R0
CJNE A,3AH,L1
L1: JNC L2
MOV A,3AH
L2: DJNZ R1,L3
L4: SJMP L4

Program and Source Code:


Address Hex object code Mnemonics Comments

Opcode Operand

0000 7B 0A MOV R3, #0AH Move 10H to register R3.

0002 78 30 MOV R0, #30H Move 30H to the register R0.

K.Uma Submission Date:


(Prof. Incharge)
BHILAI INSTITUTE OF TECHNOLOGY, DURG (C.G.)
(SETH BALKRISHAN MEMORIAL)
BHILAI HOUSE, G.E. ROAD, DURG (C.G.)-491001
Department of Electronics & Telecommunication
Engineering
B.E 7th Sem

Sub Code & Name :328713(28)Microcontroller &


Roll No: 7,8,9
Embedded Systems Lab.

0004 E4 CLR A Clear the content of register A.

0005 E6 MOV A,@R0 Move the content of memory


location pointed by register R0
to register A.

0006 08 INC R0 Increment the contents of


register R0.

0007 86 3A MOV 3A,@R0 Move the content of memory


location pointed by register R0
to memory location 3A.

0009 B5 3A 00 CJNE A,3A,000C Compare the content of


accumulator with memory
location 3A H and jump if not
equal to memory location 000C
H.

000C 50 02 JNC 0010 Jump if not carry to memory


location 0010 H.

000E E5 3A MOV A,3A Move the content of memory


location 3A to register A.

0010 D9 F4 DJNZ R1,0006 Decrement register R1 and


jump if not zero to memory
location 0006 H.

0012 80 FE SJMP 0012 End

Result: Output : Memory location - 3A H=EB H \


Memory Location: 30H=EA H

K.Uma Submission Date:


(Prof. Incharge)
BHILAI INSTITUTE OF TECHNOLOGY, DURG (C.G.)
(SETH BALKRISHAN MEMORIAL)
BHILAI HOUSE, G.E. ROAD, DURG (C.G.)-491001
Department of Electronics & Telecommunication
Engineering
B.E 7th Sem

Sub Code & Name :328713(28)Microcontroller &


Roll No: 7,8,9
Embedded Systems Lab.

31H=2C H
32H=3D H
33H=D5 H
34H=0A H
35H=1F H
36H=BA H
37H=AC H
38H=EB H
39H=0E H

K.Uma Submission Date:


(Prof. Incharge)