Saturday, April 30, 2016

8051 Program – division 8bit

; 8-bit division
; 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 DIV_8
SJMP MAIN
DIV_8:
CLR C ; clear carry flag
MOV A,R7 ; load data1 in to accumulator
MOV B,R6 ; load data1 in to B register
DIV AB ; Divide data1 by data2
store:
MOV DPTR,#ERAM ; point to external RAM
MOVX @DPTR,A ; store the quotient
INC DPTR ; point to next location
MOV A,B
MOVX @DPTR,A ; store the remainder
RET
END



Related topics:
8051 Program - arithmetic operation 8bit   |   8051 Program - addition 8bit   |   8051 Program - subtraction 8bit   |   8051 Program - multiplication 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