To perform Subtraction of two 8 – bit numbers using 8051 instruction set.
ALGORITHM:
1. Clear C – register for Carry
2. Get the data immediately .
3. Subtract the two data
4. Store the result in memory pointed by DPTR
PROGRAM:
ORG 4100
CLR C
MOV A,#data1
SUBB A,#data2
MOV DPTR,#4500
MOVX @DPTR,A
HERE: SJMP HERE
OBSERVATION:
Input: 66
23
Output: 43 (4500)
ALGORITHM:
1. Clear C – register for Carry
2. Get the data immediately .
3. Subtract the two data
4. Store the result in memory pointed by DPTR
PROGRAM:
ORG 4100
CLR C
MOV A,#data1
SUBB A,#data2
MOV DPTR,#4500
MOVX @DPTR,A
HERE: SJMP HERE
OBSERVATION:
Input: 66
23
Output: 43 (4500)
Subtraction of two 8 – bit numbers using 8051
Reviewed by enakta13
on
August 24, 2012
Rating: