Wednesday 28 September 2011

8 BIT MULTIPLICATION


8 BIT MULTIPLICATION
AIM:
            To write an assembly language program in microcontroller to perform multiplication between two 8 bit numbers.
APPARATUS REQUIRED:
                                    8051 kit, power chord
ALGORITHM:
1.      Start the program.
2.      Get the first 8 bit data in accumulator.
3.      Get the second 8 bit data in B reg.
4.      Multiply the two data.
5.      Move the address location to Data Pointer.
6.      Store the multiplied result (LSB) in the Data Pointer.
7.      Increment the Data Pointer.
8.      Move the content of B reg (MSB) to accumulator.
9.      Move the content of accumulator to the address location in DPTR.
10. Stop the program.

PROGRAM:      
ADDRESS
LABEL
OPCODE
MNEMONICS
OPERAND
COMMENTS
4300

74
MOV
A, #Data 1
Move the data (0A) to accumulator.
4301

0A



4302

75
MOV
B, #Data 2
Move the data (88) to B reg.
4303

F0



4304

88



4305

A4
MUL
A,B
Multiply the content of Acc and B reg.
4306

90
MOV
DPTR, #4500
Move the address location 4500 to DPTR.
4307

45



4308

00



4309

F0
MOVX
@DPTR,A
Move the content of accumulator to the address location (4500) in DPTR
430A

A3
INC
DPTR
Increment the content of DPTR.
430B

E5
MOV
A,B
Move the content of B to acc.
430C

F0



430D

F0
MOVX
@DPTR,A
Move the content of accumulator to the address location (4501) in DPTR
430E

80
HERE:SJMP HERE


430F

FE




INPUT:
4301: 0A                                                                   4304: 88
OUTPUT:
4500: 50 (LSB)                                                        4501: 05 (MSB)      

RESULT:
            Thus an assembly language program for the multiplication of two 8 bit numbers in microcontroller was written and executed successfully.  

0 comments:

Post a Comment