Searching \ for '[pic]: 16fxdu/8 divide routine' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: www.piclist.com/techref/microchip/math/index.htm?key=divide
Search entire site for: '16fxdu/8 divide routine'.

Exact match. Not showing close matches.
PICList Thread
'[pic]: 16fxdu/8 divide routine'
2001\03\05@072705 by Vasile Surducan

flavicon
face
Hi all,
I need a short 16bit/8bit assembler, fixed-point unsigned routine.
What I found at piclist and microchip are below.

AN617 have a long and twisted routine

16 bits by 8 with result as fraction rather than remainder by
Nikolai Golovchenk -on this one I don't know to use the fraction

http://home.netcom.com/~fastfwd/answers.html#PIC00094 from Andrew
Warren: 16-bit by 8 - site unreachable

http://www.myke.com/PICMicro/16bit.htm 16 bit by 8
- here is a modified link, I don't found 16bit.htm

http://www.dontronics.com/see.html#division 16 bit by 8
- everything you need except see.html#division

So, there is somewhere a short 16b/8b + remainder, unsigned, ?

Thank's,
Vasile

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\03\05@080832 by Andrew Warren

face
flavicon
face
Vasile Surducan <spam_OUTPICLISTTakeThisOuTspamMITVMA.MIT.EDU> wrote:

> I need a short 16bit/8bit assembler, fixed-point unsigned routine.
> What I found
> ....
> http://home.netcom.com/~fastfwd/answers.html#PIC00094 from Andrew
> Warren: 16-bit by 8 - site unreachable

Vasile:

I just checked, and my site IS reachable (from here in the USA,
anyway).

Please try again, since the 16-by-8 divide routine on that page seems
to be exactly what you want.

-Andy


=== Andrew Warren - .....fastfwdKILLspamspam@spam@ix.netcom.com
=== Fast Forward Engineering - San Diego, California
=== http://www.geocities.com/SiliconValley/2499

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\03\05@083451 by Drew Vassallo

picon face
>http://www.myke.com/PICMicro/16bit.htm 16 bit by 8
>- here is a modified link, I don't found 16bit.htm

Myke has one... he modified his website to be "Java-enabled" which makes all
the old links bogus.  You have to go through "http://www.myke.com" and follow all
the menus to get there.  It's there, but it's a pain.

Besides which, his 16bit division algorithm had a bug in it, which I fixed
for him, but he decided to change it again.  I'm not sure if the current
version he had works.

Nikolai's version should work also.. if you run through the PICLIST archives
it should be there in the math routines.

Or, if you're still looking by tonight, I can send my fixed version.  I
don't have it here at work.

--Andrew
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\03\05@113924 by Olin Lathrop

face picon face
> Or, if you're still looking by tonight, I can send my fixed version. ...

If he's still looking by tonight, then he could have written the 16 / 8
divide routine several times over himself.

This reminds me of the people you see in a parking lot cruising around for
two minutes to get the optimal parking spot in order to save 15 seconds of
walking time.


*****************************************************************
Olin Lathrop, embedded systems consultant in Devens Massachusetts
(978) 772-3129, olinspamKILLspamembedinc.com, http://www.embedinc.com

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\03\05@121349 by Mike Mansheim

flavicon
face
>http://home.netcom.com/~fastfwd/answers.html#PIC00094 from Andrew
>Warren: 16-bit by 8 - site unreachable

Here is the info from Andrew's site:
I saw the 8-bit divide routine in Question #64, but I can't figure out how
to extend it to divide one 16-bit number by another. How do you do a 16-bit
divide?

Like this. The following routine is written for clarity, not absolute
speed, but it should still perform relatively quickly:

           ; 16-Bit Divide.  Written by Andy Warren.
           ;
           ; Copyright (C) 1996 Fast Forward Engineering.  All rights
reserved.
           ; Permission is hereby granted for any non-commercial use,
           ; so long as this copyright notice remains intact.
           ;
           ; Enter with Dividend in DIVIDENDHI:DIVIDENDLO, divisor in
           ; DIVISORHI:DIVISORLO.
           ;
           ; Exits with quotient in QUOTIENTHI:QUOTIENTLO, remainder in
           ; REMAINDERHI:REMAINDERLO.

           DIVIDE16:

                   CLRF    REMAINDERHI     ;CLEAR THE REMAINDER.
                   CLRF    REMAINDERLO     ;

                   MOVLW   16              ;WE'RE DIVIDING BY A 16-BIT
DIVISOR.
                   MOVWF   COUNT           ;

           DIVLOOP:

                   RLF     DIVIDENDLO      ;SHIFT DIVIDEND LEFT 1 BIT INTO
                   RLF     DIVIDENDHI      ;REMAINDERHI:REMAINDERLO.
                   RLF     REMAINDERLO     ;
                   RLF     REMAINDERHI     ;

                   MOVF    DIVISORHI,W     ;COMPARE THE DIVISOR TO THE
PORTION OF THE
                   SUBWF   REMAINDERHI,W   ;DIVIDEND THAT'S BEEN SHIFTED
INTO REMHI.

                   BNZ     CHECKLESS       ;IF THE TWO HI-BYTES AREN'T THE
SAME, JUMP
                                           ;AHEAD.

                   MOVF    DIVISORLO,W     ;OTHERWISE, WE HAVE TO COMPARE
THE
                   SUBWF   REMAINDERLO,W   ;LO-BYTES.

           CHECKLESS:

                   BNC     NOSUB           ;IF THE SHIFTED PORTION OF THE
DIVIDEND WAS
                                           ;LESS THAN THE DIVISOR, JUMP
AHEAD.

                   MOVF    DIVISORLO,W     ;OTHERWISE, REMAINDER =
REMAINDER - DIVISOR.
                   SUBWF   REMAINDERLO     ;
                   MOVF    DIVISORHI,W     ;
                   SKPC                    ;
                   INCFSZ  DIVISORHI       ;
                   SUBWF   REMAINDERHI     ; (CARRY'S ALWAYS SET AT THIS
POINT.)

           NOSUB:

                   RLF     QUOTIENTLO      ;IF WE JUST SUBTRACTED, SHIFT A
"1" INTO
                   RLF     QUOTIENTHI      ;THE QUOTIENT.  OTHERWISE,
SHIFT A "0".

                   DECFSZ  COUNT           ;HAVE WE SHIFTED ENOUGH BITS?
                   GOTO    DIVLOOP         ;IF NOT, LOOP BACK.

           ; AT THIS POINT, THE QUOTIENT IS IN QUOTIENTHI:LO AND THE
REMAINDER IS
           ; IN REMAINDERHI:LO.

--
http://www.piclist.com hint: The PICList is archived three different
ways.  See http://www.piclist.com/#archives for details.


2001\03\06@020131 by Vasile Surducan

flavicon
face
Thank's very much,
Vasile


On Mon, 5 Mar 2001, Mike Mansheim wrote:

{Quote hidden}

--
http://www.piclist.com#nomail Going offline? Don't AutoReply us!
email .....listservKILLspamspam.....mitvma.mit.edu with SET PICList DIGEST in the body


More... (looser matching)
- Last day of these posts
- In 2001 , 2002 only
- Today
- New search...