0% found this document useful (0 votes)
234 views4 pages

8051 Microcontroller Cycle II Programs

The document discusses assembly language programs for the 8051 microcontroller that perform various arithmetic, logical, and bitwise operations on 8-bit and 16-bit data. These include programs for 8-bit addition, subtraction, multiplication, division, AND, OR, and XOR logic as well as 16-bit addition and subtraction. The final program demonstrates rotate and swap instructions. All programs use MOV, ADD, SUBB, MUL, DIV, ANL, ORL, and other instructions to manipulate data in registers and memory locations and produce the expected output.

Uploaded by

Rak Esh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
234 views4 pages

8051 Microcontroller Cycle II Programs

The document discusses assembly language programs for the 8051 microcontroller that perform various arithmetic, logical, and bitwise operations on 8-bit and 16-bit data. These include programs for 8-bit addition, subtraction, multiplication, division, AND, OR, and XOR logic as well as 16-bit addition and subtraction. The final program demonstrates rotate and swap instructions. All programs use MOV, ADD, SUBB, MUL, DIV, ANL, ORL, and other instructions to manipulate data in registers and memory locations and produce the expected output.

Uploaded by

Rak Esh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

8051 MICROCONTROLLER

II CYCLE:

1. Assembly Language Programs to Perform Arithmetic (Both Signed and Unsigned) 16 Bit Data Operations,
Logical Operations (Byte and Bit Level Operations), Rotate, Shift, Swap and Branch Instructions

a) 8-bit Addition:
AIM: To perform 8 bit addition by using 8051.
APPARATUS: 8051 with keyboard/Keil software.
PROGRAM:
MOV A,#02H
MOV B,#02H
ADD A,B
END
OUTPUT:

b) 8 bit subtraction:
AIM: To perform 8 bit subtraction by using 8051.
APPARATUS: 8051 with keyboard/Keil software.
PROGRAM:
MOV A,#04H
MOV B,#02H
SUBB A,B
END
OUTPUT:

c) 8 bit multiplication:
AIM: To perform 8 bit multiplication by using 8051.
APPARATUS: 8051 with keyboard/Keil software.
PROGRAM:
MOV DPTR,#9000H
MOVX A,@DPTR
MOV B,A
INC DPTR
MOVX A,@DPTR
MUL AB
INC DPTR
MOVX @DPTR,A
INC DPTR
MOV A,B
MOVX @DPTR,A
End
OUTPUT:
d) 8 bit division:
AIM: To perform 8 bit division by using 8051.
APPARATUS: 8051 with keyboard/Keil software.
PROGRAM:
MOV DPTR,#9000H
MOVX A,@DPTR
MOV B,A
INC DPTR
MOVX A,@DPTR
DIV AB
INC DPTR
MOVX @DPTR,A
INC DPTR
MOV A,B
MOVX @DPTR,A
End
OUTPUT:

e) 8 bit AND Logic:


AIM: To perform 8 bit AND logic by using 8051.
APPARATUS: 8051 with keyboard/Keil software.
PROGRAM:
MOV R0,#40H
MOV A,@R0
INC R0
MOV B,@R0
ANL A,B
INC R0
MOV @R0,A
End
OUTPUT:

f) 8 bit OR Logic:
AIM: To perform 8 bit OR logic by using 8051.
APPARATUS: 8051 with keyboard/Keil software.
PROGRAM:
MOV R0,#40H
MOV A,@R0
INC R0
MOV B,@R0
ORL A,B
INC R0
MOV @R0,A
End
OUTPUT:
g) 8 bit EX-OR Logic:
AIM: To perform 8 bit EX-OR logic by using 8051.
APPARATUS: 8051 with keyboard/Keil software.
PROGRAM:
MOV R0,#40H
MOV A,@R0
INC R0
MOV B,@R0
ORL A,B
INC R0
MOV @R0,A
End
OUTPUT:

h) 16 bit addition:
AIM: To perform 16 bit addition by using 8051.
APPARATUS: 8051 with keyboard/Keil software.
PROGRAM:
MOV DPTR,#2040H
MOV A,#20H
MOV B,#31H
ADD A,DPL
MOV DPL,A
MOV A,B
ADDC A,DPH
MOV DPH,A
End
OUTPUT:

i) 16 bit subtraction:
AIM: To perform 16 bit subtraction by using 8051.
APPARATUS: 8051 with keyboard/Keil software.
PROGRAM:
MOV DPTR,#2040H
MOV A,#20H
MOV B,#31H
SUBB A,DPL
MOV DPL,A
MOV A,B
SUBB A,DPH
MOV DPH,A
End
OUTPUT:
J) Program with Rotate and swap instructions :
AIM: To perform 8 bit rotate and swap by using 8051.
APPARATUS: 8051 with keyboard/Keil software.
PROGRAM:
MOV A,#20H
MOV B,#31H
RL A
MOV R0,A
SETB C
MOV A,B
RRC A
SWAP A
End
OUTPUT:

You might also like