please dont rip this site

PIC Microcontoller Math Method

32x16 multiplication

from Anonymous Author

;As a thank you for all the code, here is a 32x16 bit Mult.
;Unsigned 32 bit by 16 bit multiplication
;This routine will take a4:a3:a2:a1*b2:b1 -> a6:a5:a4:a3:a2:a1

mult_32_16:
		banksel	EECON1
; Begin rearrange code
	nop
	movf	a4,w
	movwf	a6
	movf	a3,w
	movwf	a5
	movf	a2,w
	movwf	a4
	movf	a1,w
	movwf	a3
; End rearrange code
                CLRF    a2          ; clear partial product
                CLRF    a1
                MOVF    a6,W
                MOVWF   c4
                MOVF    a5,W
                MOVWF   c3
                MOVF    a4,W
                MOVWF   c2
                MOVF    a3,W
                MOVWF   c1

                MOVLW   0x08
                MOVWF   bitcnt

LOOPUM3216A:
                RRF     b1, F
                BTFSC   STATUS, C
                GOTO    ALUM3216NAP
                DECFSZ  bitcnt, F
                GOTO    LOOPUM3216A

                MOVWF   bitcnt

LOOPUM3216B:
                RRF     b2, F
                BTFSC   STATUS, C
                GOTO    BLUM3216NAP
                DECFSZ  bitcnt, F
                GOTO    LOOPUM3216B

                CLRF    a6
                CLRF    a5
                CLRF    a4
                CLRF    a3
                RETLW   0x00

BLUM3216NAP:
                BCF     STATUS, C
                GOTO    BLUM3216NA

ALUM3216NAP:
                BCF     STATUS, C
                GOTO    ALUM3216NA

ALOOPUM3216:
                RRF     b1, F
                BTFSS   STATUS, C
                GOTO    ALUM3216NA
                MOVF   c1,W
                ADDWF   a3, F
                MOVF    c2,W
                BTFSC   STATUS, C
                INCFSZ  c2,W
                ADDWF   a4, F
                MOVF    c3,W
                BTFSC   STATUS, C
                INCFSZ  c3,W
                ADDWF   a5, F
                MOVF    c4,W
                BTFSC   STATUS, C
                INCFSZ  c4,W
                ADDWF   a6, F

ALUM3216NA:
                RRF    a6, F
                RRF    a5, F
                RRF    a4, F
                RRF    a3, F
                RRF    a2, F
                DECFSZ  bitcnt, f
                GOTO    ALOOPUM3216

                MOVLW   0x08
                MOVWF   bitcnt

BLOOPUM3216:
                RRF    b2, F
                BTFSS  STATUS, C
                GOTO   BLUM3216NA
                MOVF   c1,W
                ADDWF  a3, F
                MOVF   c2,W
                BTFSC  STATUS, C
                INCFSZ c2,W
                ADDWF  a4, F
                MOVF   c3,W
                BTFSC  STATUS, C
                INCFSZ c3,W
                ADDWF  a5, F
                MOVF   c4,W
                BTFSC  STATUS, C
                INCFSZ c4,W
                ADDWF  a6, F

BLUM3216NA
                RRF    a6, F
                RRF    a5, F
                RRF    a4, F
                RRF    a3, F
                RRF    a2, F
                RRF    a1, F
                DECFSZ  bitcnt, F
                GOTO    BLOOPUM3216
	nop
	return


file: /Techref/microchip/math/mul/32x16-a.htm, 3KB, , updated: 2010/3/30 07:19, local time: 2024/11/15 20:28,
TOP NEW HELP FIND: 
18.118.166.130:LOG IN

 ©2024 These pages are served without commercial sponsorship. (No popup ads, etc...).Bandwidth abuse increases hosting cost forcing sponsorship or shutdown. This server aggressively defends against automated copying for any reason including offline viewing, duplication, etc... Please respect this requirement and DO NOT RIP THIS SITE. Questions?
Please DO link to this page! Digg it! / MAKE!

<A HREF="http://massmind.ecomorder.com/techref/microchip/math/mul/32x16-a.htm"> PIC Microcontoller Math Method 32x16 multiplication </A>

After you find an appropriate page, you are invited to your to this massmind site! (posts will be visible only to you before review) Just type a nice message (short messages are blocked as spam) in the box and press the Post button. (HTML welcomed, but not the <A tag: Instead, use the link box to link to another page. A tutorial is available Members can login to post directly, become page editors, and be credited for their posts.


Link? Put it here: 
if you want a response, please enter your email address: 
Attn spammers: All posts are reviewed before being made visible to anyone other than the poster.
Did you find what you needed?

 

Welcome to ecomorder.com!

 
Quick, Easy and CHEAP! RCL-1 RS232 Level Converter in a DB9 backshell
Ashley Roll has put together a really nice little unit here. Leave off the MAX232 and keep these handy for the few times you need true RS232!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .