+ Reply to Thread
Results 1 to 5 of 5

Thread: 32 bit math

  1. #1
    Join Date
    Mar 2006
    Posts
    14

    Default 32 bit math

    I have to add 2 numbers in a very repetitive sequence.One is 10 bit and the other -where the addition is registered- should be a 32 bit register. Could anyone suggest a subroutine to add these numbers, compatible with PBPro?
    Thanks in advanced
    -Francesc

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

    Default

    Piece of Cake.
    Code:
    Result  VAR WORD[2]
    Avar    VAR WORD
    
    Result[0] = Result[0] + Avar
    if Result[0] < Avar then Result[1] = Result[1] + 1
    _
    DT

  3. #3
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by fnovau View Post
    Could anyone suggest a subroutine to add these numbers, compatible with PBPro?
    Thanks in advanced
    -Francesc
    Upgrade to PBP 2.50a?

  4. #4
    Join Date
    Mar 2006
    Posts
    14

    Default 32 bit math

    Quote Originally Posted by skimask View Post
    Upgrade to PBP 2.50a?
    Do you mean I have to upgrade to 2.50a version for using Darrel code? I use Pic16F677 and my PBP is 2.47 version

  5. #5
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by fnovau View Post
    Do you mean I have to upgrade to 2.50a version for using Darrel code? I use Pic16F677 and my PBP is 2.47 version
    No, I only meant that an upgrade to PBP 2.50a includes support for LONG variable types, which are 31 bit signed variables, whereas 2.47 and earlier support WORDs, 16 bit unsigned variables at most.
    And the upgrade is only $25.

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. Averaging 16 bit values without using 32 bit math
    By sirvo in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 5th October 2007, 22:18
  3. PIC18Fxx math 24 & 32 bit
    By ronsimpson in forum mel PIC BASIC Pro
    Replies: 8
    Last Post: - 2nd December 2006, 12:52
  4. 32 bit math
    By Charles Linquis in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 28th August 2006, 13:34
  5. USART interrupt not interrupting right
    By Morpheus in forum mel PIC BASIC Pro
    Replies: 12
    Last Post: - 6th March 2005, 01:07

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