Switch to full style
PIC Assembly Articles
Post a reply

multiply two numbers in PIC assembly

Sat May 11, 2013 11:23 pm

multiply two numbers in PIC assembly at specific address ( N and M)
Code:

movwf N
,; "
movf M+1,W,A
mulwf N+1,A ; compute M(H) x N(H)
movff PRODL,PR+2
movff PRODH,PR+3
movf M,W,A ; compute M(L) x N(L)
mulwf N,A
movff PRODL,PR
movff PRODH,PR+1
movf M,W,A
mulwf N+1,A ; compute M(L) xN(H)
movf PRODL,W,A ; add M(L) x N(H) to P(R)
addwf PR+1,F,A ; "
movf PRODH,W,; "
addwfc PR+2,F,A ; "
movlw 0 ; "
addwfc PR+3,F,A ; add carry
movf M+1,W,A
mulwf N,A ; compute M(H) x N(L)
f PRODL WA dd M N t PR
movf PRODL,W,A ; add M(H) x N(L) to PR
addwf PR+1,F,A ; "
movf PRODH,W,; "
addwfc PR+2,F,A ; "
movlw 0 ; "
addwfc PR+3,F,A ; add carry
nop
end




Post a reply
  Related Posts  to : multiply two numbers in PIC assembly
 PIC Assembly For Loop Example     -  
 macro usage PIC assembly     -  
 TEMPERATURE AND HEAT CONTROL Assembly     -  
 Elements of Assembly Language Instruction     -  
 MULTIPLEXING Seven SEGMENT DECODER Assembly     -  
 playfair cipher assembly code     -  
 Control Directives usage PIC assembly     -  
 Motor DC Speed Control by switching ON and OFF Assembly     -  
 Object File Directives Usage PIC Assembly     -  
 add two 24-bit numbers (sum two numbers)     -