Searching \ for '[PIC]:8bit by 8bit fixed point division' in subject line. ()
Make payments with PayPal - it's fast, free and secure! Help us get a faster server
FAQ page: techref.massmind.org/techref/microchip/math/index.htm?key=division
Search entire site for: '8bit by 8bit fixed point division'.

Exact match. Not showing close matches.
PICList Thread
'[PIC]:8bit by 8bit fixed point division'
2001\04\13@134203 by andstel

flavicon
Hi all,
I really need your help
I am trying to make 8bit fixed point division with 16f877 and i used the
code of
AN617 but i am not able to make it work when i simulate it.
I am new in PIC assembly .
What i am doing wrong?
If you cannot tell me what i am doing wrong and how to fix it ,is there any
other better way to make 8bit by 8 bit fixed point division?

Stelios Andreou



Here is my code:

 list  p=16f877
     #include p16f877.inc
     errorlevel -302
AARGB0 equ h'20'
BARGB0 equ h'22'
REMB0  equ h'24'
LOOPCOUNT equ h'26'
store1 equ h'28'
store2 equ h'30'

     org 0x00
     goto start

     org 0x05
start
      movlw h'09'
      movwf store1
      movlw h'03'
      movwf store2
;8/8 Bit Unsigned Fixed Point Divide 8/8 -> 08.08

;       Input:  8 bit unsigned fixed point dividend in AARGB0
;               8 bit unsigned fixed point divisor in BARGB0

;       Use:    CALL    FXD0808U

;       Output: 8 bit unsigned fixed point quotient in AARGB0
;               8 bit unsigned fixed point remainder in REMB0

;       Result: AARG, REM  <--  AARG / BARG

;       Max Timing:     1+97+2 = 100 clks

;       Min Timing:     1+89+2 = 92 clks

;       PM: 1+13+1 = 15         DM: 4

       call FXD0808U
loop3   goto loop3

FXD0808U
     clrf            REMB0

      UDIV0808L macro store1,store2,REMB0,LOOPCOUNT;

      return

UDIV0808L  macro AARGB0,BARGB0,REMB0,LOOPCOUNT;

;       Max Timing: 2+7*12+11 = 97 clks

;       Min Timing: 2+7*11+10 = 89 clks

;       PM: 13                                  DM: 4

               MOVLW           8
               MOVWF           LOOPCOUNT

LOOPU0808A      RLF             AARGB0,W
               RLF             REMB0, F
               MOVF            BARGB0,W
               SUBWF           REMB0, F

               BTFSC           _C
               GOTO            UOK88A
               ADDWF           REMB0, F
               BCF             _C
UOK88A          RLF             AARGB0, F

               DECFSZ          LOOPCOUNT, F
               GOTO            LOOPU0808A

               endm
       end

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


2001\04\13@142408 by Drew Vassallo

picon face
>I am trying to make 8bit fixed point division with 16f877 and i used the
>code of
<snip>
>other better way to make 8bit by 8 bit fixed point division?

Search the PICLIST archives.  There are tons in the math routines section.

I'll be upset if anyone does this for him.  And I *know* James will be :)

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

--
http://www.piclist.com hint: The list server can filter out subtopics
(like ads or off topics) for you. See http://www.piclist.com/#topics


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