PBP 2.50 and Longs


Closed Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2007
    Posts
    24

    Default PBP 2.50 and Longs

    Hi,
    I'm currently using PBP 2.47 and Byte Arrays to get data from a GPS. This works OK but doing any maths is compicated.

    Am I right in thinking that if I upgrade to PBP 2.50 and use an 18F that I can read a 7 digit number as an integer and then do maths on it.

    Eg: If I want to read 3557.1542361. Can I use:

    LATDEG VAR WORD
    LATMIN VAR LONG

    SERIN2 RXPIN, 16468,[DEC4 LATDEG, DEC7 LATMIN]

    If it works as easily as this is it possible to have more accarate trig and SQRT functions as well.

    Thanks for anyy help.

    Mike

  2. #2
    skimask's Avatar
    skimask Guest

    Default

    Quote Originally Posted by mikendee View Post
    Am I right in thinking that if I upgrade to PBP 2.50 and use an 18F that I can read a 7 digit number as an integer and then do maths on it.
    Eg: If I want to read 3557.1542361. Can I use:
    LATDEG VAR WORD
    LATMIN VAR LONG
    SERIN2 RXPIN, 16468,[DEC4 LATDEG,,".", DEC7 LATMIN]
    If it works as easily as this is it possible to have more accarate trig and SQRT functions as well.
    The accuracy won't improve any, since PBP only handles straight integer numbers, doesn't do anything with fractions.
    However, you can multiply the numbers up a bit, say by 10000, then work on them.
    You'll end up with a simulated decimal point at 1/10000...but you'll have to correct for that when displaying/sending that data.
    That probably won't help any with SIN/COS and SQRT functions at all unless you start getting creative with your math.

Similar Threads

  1. Using longs with PBP2.6
    By Chris Barron in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 16th November 2009, 20:14
  2. PIcbasic pro patch 2.5B, still no longs..
    By Chris Barron in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 11th March 2009, 16:42
  3. Longs and Serial EEPROMS...
    By TerdRatchett in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 6th March 2009, 01:17
  4. Using both DIV32 and LONGs together
    By BrianT in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 9th January 2009, 13:46
  5. PBPL 2.50 observations
    By BrianT in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 18th September 2007, 00:58

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