Monday, July 25, 2011

Multiplying with 8 bit answer using loop in 8051

; program to multiply two numbers using loop answer is 8 bit 
ORG 0H;
MOV A, #00H ;
MOV R0,#13H

AGAIN: ADD A, #12H;
       DJNZ R0,AGAIN;
END

2 comments:

  1. Replies
    1. Basically we are multiplying 13 and 12 in hexadecimal.
      13H * 12H = E4H
      12 is added 13 times
      So ADD A # 12H does it once
      then we subtract the 13 counter check whether it is zero if not then we add again till the 13 in R0 becomes 0
      Answer is stored in A

      Delete