;malin@onspec.co.uk ;unsigned multiply of a2:a1 with b2:b1 leaving result in res4:res3:res2:res1 ; These 8 variables need to be defined ; ; Program length 32 line ; time 129 to 228 cycles ; This program looks at the lsb of a1 to decide whether to add b1 to res2 ; ; and b2 to res3, with appropriate carrys ; It then looks at the lsb of a2 to decide whether to add b1 to res3 and ; b2 to res4, again with appropriate carrys. ; The rotates then only have to be done 8 times ; ; This is uses slightly more program but takes a little less time than ; a routine that performs one 16 bit addition per rotate and 16 rotates ; ; Multiple byte addition routine from Microchip AN617 ; Result registers used as loop counter from Bob Fehrenbach & Scott Dattalo ; clrf res4 clrf res3 clrf res2 movlw 0x80 movwf res1 nextbit rrf a2,f rrf a1,f btfss status, carry goto nobit_l movf b1,w addwf res2,f movf b2, w btfsc status, carry incfsz b2, w addwf res3, f btfsc status, carry incf res4, f bcf status, carry nobit_l btfss a1, 7 goto nobit_h movf b1,w addwf res3,f movf b2, w btfsc status, carry incfsz b2, w addwf res4, f nobit_h rrf res4,f rrf res3,f rrf res2,f rrf res1,f btfss status, carry goto nextbit
file: /Techref/microchip/math/mul/16x16umalin.htm, 1KB, , updated: 2002/10/28 10:07, local time: 2024/11/8 16:27,
18.224.57.86:LOG IN ©2024 PLEASE DON'T RIP! THIS SITE CLOSES OCT 28, 2024 SO LONG AND THANKS FOR ALL THE FISH!
|
©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? <A HREF="http://www.piclist.com/techref/microchip/math/mul/16x16umalin.htm"> PIC Microcontoller Math Method Multiply 16x16 bit from malin</A> |
Did you find what you needed? |
PICList 2024 contributors:
o List host: MIT, Site host massmind.org, Top posters @none found - Page Editors: James Newton, David Cary, and YOU! * Roman Black of Black Robotics donates from sales of Linistep stepper controller kits. * Ashley Roll of Digital Nemesis donates from sales of RCL-1 RS232 to TTL converters. * Monthly Subscribers: Gregg Rew. on-going support is MOST appreciated! * Contributors: Richard Seriani, Sr. |
Welcome to www.piclist.com! |
.