Saturday, April 30, 2016

8051 Program – multiplication 8bit

; 8-bit multiplication
; R7*R6
ORG 0H
ERAM EQU 4000H
MAIN:
MOV R7,#20 ; load data1 in to R7
MOV R6,#15 ; load data2 in to R6
LCALL MUL_8
SJMP MAIN
MUL_8:
CLR C ; clear carry flag
MOV A,R7 ; load data1 in to accumulator
MOV B,R6 ; load data1 in to B register
MUL AB ; multiply data1 and data2
store:
MOV DPTR,#ERAM ; point to external RAM
MOVX @DPTR,A ; store the lower order of the result
INC DPTR ; point to next location
MOV A,B
MOVX @DPTR,A ; store the higher order of the result
RET
END



Related topics:
8051 Program - arithmetic operation 8bit   |   8051 Program - addition 8bit   |   8051 Program - subtraction 8bit   |   8051 Program - division 8bit   |   8051 Program - addition 16bit   |   8051 Program - subtraction 16bit   |   8051 Program - multiplication 16bit   |   8051 Program - division 16bit   |   8051 Program - addition multibyte   |   8051 Program - multiplication 16bit by 8bit   |   8051 Program - addition 8bit 2digit bcd   |   8051 Program - memory subroutines   |   8051 Program - math subroutines   |   8051 Program - conversion subroutines

List of topics: 8051

No comments:

Post a Comment