EXP1: Programming using Arithmetic, Logical, branching, and loop
operations by 8051 Microcontroller.
AIM: To write an Assembly Language Program to perform Arithmetic, Logical, branching, and
loop instructions of 8051
APPARATUS:
1. Lab Computer
2. Keil Software
PROCEDURE:
ARITHMETIC OPERATIONS
Program: 8 Bit Addition
ORG 00h
MOV A,#12
MOV B,#45
ADD A,B
END
Program: 8 Bit Subtraction
ORG 00h
MOV A,#45
MOV B,#15
SUBB A,B
END
Program: 8 Bit Multiplication
ORG 00h
MOV A,#12h
MOV B,#12h
MUL AB
END
Program: 8 Bit Division
ORG 00h
MOV A,#45h
MOV B,#05h
DIV AB
ENDS
LOGICAL OPERATIONS
Program: AND Operation
ORG 00h
MOV A,#22h
MOV R0,#0Fh
ANL A,R0
END
Program: OR Operation
ORG 00h
MOV A,#22h
MOV R0,#0Fh
ORL A,R0
END
Program: XOR Operation
ORG 00h
MOV A,#22h
MOV R0,#0Fh
XRL A,R0
END
Program: Bit Manipulation Instructions
ORG 00h
MOV A,#55h
CPL A
END
BRANCHING AND LOOP OPERATIONS
Program: Write a program to add 2 to register A 100 times using looping.
ORG 00h
MOV A, #00
MOV R1, #100
LOOP: ADD A, #02
DJNZ R1, LOOP
END
RESULT: Programming using arithmetic, logical, branching, and loop instructions of 8051
Viva:
1) What are the features of 8051 microcontrollers?
2) Explain PSW?
3) What are bank registers?
4) What is internal memory in 8051?
5) Explain about shift and rotate instruction?