PDA

View Full Version : 32 bit math



fnovau
- 11th February 2008, 20:02
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

Darrel Taylor
- 11th February 2008, 20:31
Piece of Cake.

Result VAR WORD[2]
Avar VAR WORD

Result[0] = Result[0] + Avar
if Result[0] < Avar then Result[1] = Result[1] + 1

_

skimask
- 12th February 2008, 05:04
Could anyone suggest a subroutine to add these numbers, compatible with PBPro?
Thanks in advanced
-Francesc

Upgrade to PBP 2.50a?

fnovau
- 12th February 2008, 20:06
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

skimask
- 12th February 2008, 23:55
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.