To perform division of two 8 – bit numbers using 8051 instruction set.
ALGORITHM:
1. Get the data in A – reg.
2. Get the value to be divided in B – reg.
3. Divide the two data
4. The quotient is in A – reg.
5. The remainder is in B – reg.
6. Store the results.
PROGRAM:
ORG 4100
CLR C
MOV A,#data1
MOV B,#data2
DIV AB
MOV DPTR,#4500
MOVX @DPTR,A
INC DPTR
MOV A,B
MOVX @DPTR,A
HERE: SJMP HERE
OBSERVATION:
Input: 05
03
Output: 01 (4500)
02 (4501)
ALGORITHM:
1. Get the data in A – reg.
2. Get the value to be divided in B – reg.
3. Divide the two data
4. The quotient is in A – reg.
5. The remainder is in B – reg.
6. Store the results.
PROGRAM:
ORG 4100
CLR C
MOV A,#data1
MOV B,#data2
DIV AB
MOV DPTR,#4500
MOVX @DPTR,A
INC DPTR
MOV A,B
MOVX @DPTR,A
HERE: SJMP HERE
OBSERVATION:
Input: 05
03
Output: 01 (4500)
02 (4501)
division of two 8 – bit numbers using 8051
Reviewed by enakta13
on
August 24, 2012
Rating: