This is the code that I have come up with at this point, but it does not seem work. I have been at this for hours I just do not see the problem, but I am new to this so it could be something simple. I am required to use the PIC16F887 thus i am limited to its' instruction set. The code is in Assembly also
I am attempting to use the add and shift method my code is below
cblock 0x020
multiplicand_low,multiplicand_high,product_low,product_high,multiplier,count
endc
org 0x00
Init
movlw .0
movwf product_low
movlw .0
movwf product_high
movlw .8
movwf count
goto Main
Main call Prob1
Prob1 movlw 0x9D
movwf multiplicand_low
movlw 0xA3
movwf multiplier
call Multiply
Multiply
rrf multiplier,F
btfsc status,C
call Add
rrf multiplicand_low,F
rrf multiplicand_low,F
decfsz count
return
goto $
Add
movf multiplicand_low,W
addwf product_low,F
btfsc status,C
incf product_high,F
movf multiplicand_high,W
addwf product_high,F
return
I am attempting to use the add and shift method my code is below
cblock 0x020
multiplicand_low,multiplicand_high,product_low,product_high,multiplier,count
endc
org 0x00
Init
movlw .0
movwf product_low
movlw .0
movwf product_high
movlw .8
movwf count
goto Main
Main call Prob1
Prob1 movlw 0x9D
movwf multiplicand_low
movlw 0xA3
movwf multiplier
call Multiply
Multiply
rrf multiplier,F
btfsc status,C
call Add
rrf multiplicand_low,F
rrf multiplicand_low,F
decfsz count
return
goto $
Add
movf multiplicand_low,W
addwf product_low,F
btfsc status,C
incf product_high,F
movf multiplicand_high,W
addwf product_high,F
return
Last edited: