please dont rip this site

PIC Microcontoller Math Method

24x24 multiplication from Fred Maher w/ Tutorial

...on my holiday I had time to create my own 24 x 24 multiplication routine.

Now it may be of interest for the beginners list and then again it may not be.

The beast is chunky compared to the small and sleek offerings on other sites, well to be truthful, only found one other routine and that was in the PICLIST. It started life aimed squarely at the beginner with as few as possible loops so as to make it more clear what was happening in the registers and how the bits are carried or shifted. So let's say euphemistically it is " linear code".

The routine is also easily expandable by adding more variables and by copying then adding the higher numbers for top, bot and res. in their respective code blocks in the add and shift blocks. steps 2 and 3 and 4 It also comes with built in example numbers which you can play with, and change /check for other results...products.

Also aimed at the beginner, and analogue fossils like myself, who need a visual image of processes, the words multiplier, multiplicand, product are not very visual. After a while I realized that the universal words are.

TOP
BOTTOM
RESULT

So I have used in the routine :- top is multiplicand, bottom is multiplier and product is result. This also is directly applicable to division and addition and subtraction. In fact in my own project program I've got rid of a whole lot of variables in these maths routines and I just need one more word REMAINDER for the division.

I' m incorporating it into my own advanced bike computer project as I needed something to manage 3 x 3 register multiplication. The routine is "intelligent" as it can swap round and use the smaller of the two numbers as the multiplier. I built this into the routine as the time savings are important. big x small = 350us whereas small x big = 120usec.

I explain this in detail in the comments of the fully annotated version mult24a.asm The minimum comment version is mult24.asm

The routines have been compiled and checked with number ranging from 3 x 3 = 9 to FFFFFF * FFFFFF = FFFFFE000001 = 281,474,943,156,225.

I can't guarantee that there is no number combination between these two extremes that will give a wrong answer, but by now I think it is highly improbable.

The.... number * 0 case ....can't happen in my application but if it is needed, it is easily accommodate in the compare routine which precedes the actual multiplication. The last compare of the low order registers can obviously produce 0. Then it is a simple matter to make res6,5,4,3,2,1 also zero. and skip the multiplication main body.

So summing up.

mult24.asm ;few comments mult24a.asm ;heavily commented


file: /Techref/microchip/math/mul/24x24b-fm.htm, 3KB, , updated: 2002/11/7 11:49, local time: 2024/12/30 08:35,
TOP NEW HELP FIND: 
18.222.118.236: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://techref.massmind.org/Techref/microchip/math/mul/24x24b-fm.htm"> PIC Microcontoller Math Method - 24x24 multiplication from Fred Maher w/ Tutorial</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 massmind.org!

 

Welcome to techref.massmind.org!

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

  .