Mathematics and remainder for PLL MC145158


Closed Thread
Results 1 to 16 of 16

Hybrid View

  1. #1
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    R2 is one of PBP's system variables. They are defined in the PBPPICxx.RAM files, located in the PBP folder.

    In this case R2 holds the modulas (remainder) of the DIV32 command.

    For more info ... http://www.picbasic.co.uk/forum/showthread.php?t=48

    <br>
    DT

  2. #2


    Did you find this post helpful? Yes | No

    Default

    So this is basically the same as the // but only for DIV32?

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Correct!<br><br>
    DT

  4. #4


    Did you find this post helpful? Yes | No

    Default

    On that note though would you not think that it would be listed as a reserved word?

  5. #5
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Question

    Quote Originally Posted by Darrel Taylor
    R2 is one of PBP's system variables. They are defined in the PBPPICxx.RAM files, located in the PBP folder.

    In this case R2 holds the modulas (remainder) of the DIV32 command.

    <br>
    I was looking through this file, hoping to learn some of that voodoo that Darrel pops on us time to time... but all the definition said was "System Register". Does anyone know just what exactly these other variables mean or do? Is it documented somewhere that I have missed?

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    I've been found out. I guess I can take those pins out of my Rhinoceros doll now.

    While the PBPPICxx.RAM declares the system variables, the PBPPICxx.LIB and PBPPICxx.MAC files are where you'll find out how they are used.

    For instance, with the DIV32 command on an 18F part... Open up the PBPPIC18.LIB file and search for DIV32. You'll find this header in front of the code for the DIV32 command.
    Code:
    ;************************************************
    ;* DIV32      : 31 x 15 divide
    ;*                                    
    ;* Input      : R0, R2 = 32 bits 
    ;*            : R1 + 1, W = divisor
    ;* Output     : R0 = quotient    
    ;*            : R2 = remainder      
    ;*                                        
    ;* Notes      : Uses result from MUL. 
    ;************************************************
    From that you can see that R2 is the remainder of a DIV32, even though it's not mentioned anywhere in the manual.

    Most of the PBP macros have a header showing the input and output variables, but not necessarily all the system variables that are used by that routine. For that you have to digest the code and follow subroutine calls.

    As far as I know, there is no list of macro's or the system variables that they use. My guess is that it would create a tech support nightmare for them if they put that kind of stuff in the manual. Can't blame them.

    <br>
    DT

  7. #7
    Join Date
    Mar 2005
    Location
    Iowa, USA
    Posts
    216


    Did you find this post helpful? Yes | No

    Smile

    aaaahhh..... it's a dark mysterious art. I shall take your teachings and proceed with caution. As for the pins.... I'll consider it some kind of hazing/right of passage ritual. Seriously... thanks for the info.

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts