32 and 64bit Floating Point, PBP and a 16F648A...


Closed Thread
Results 1 to 8 of 8
  1. #1

    Default 32 and 64bit Floating Point, PBP and a 16F648A...

    I need to process some GPS data that is in 32bit and 64bit Floating Point format.
    My PIC16F648A project gathers serial data from a GPS Disciplined Oscillator unit and stores it in a array.

    This past week I didn't even know what 32 or 64bit Floating Point was, now I understand how to assemble the floating point data into a decimal number, from the HEX bytes, on paper. But, I need to have PBP do the math for me.

    Here is an example of the oscillator temperature data in 32bit FP:
    MSB..........LSB
    41E99BBE

    Here is what I have been trying to do with PBP...
    The following code ignores the 'Sign' bit in Byte1 and is to extract the 'Exponent' from the next 11 bits.

    B0 = 0 'EXPONENT
    B1 = BYTE1.BIT6
    IF B1 = 1 THEN LET B0 = B0 + 128

    B1 = BYTE1.BIT5
    IF B1 = 1 THEN LET B0 = B0 + 64
    .
    .
    .


    The following code example is to extract the Mantissa from the remaining bits

    B2 = 0 'MANTISSA
    B3 = BYTE2.BIT3
    IF B3 = 1 THEN LET B2 = B2 + .5

    B3 = BYTE2.BIT2
    IF B3 = 1 THEN LET B2 = B2 + .125
    .
    .
    .

    Unfortunately, I get the following PBP messages when trying to compile.:

    ERROR Line 158: Bad variable modifier: .125.
    ERROR Line 158: Bad expression. (vmon5_0.pbp)

    Is there an easier way?

    Thanks,

    John
    Last edited by johnmaetta; - 26th September 2010 at 01:04.

  2. #2
    Join Date
    Oct 2004
    Posts
    440


    Did you find this post helpful? Yes | No

    Default

    See N-Bit_MATH

    Norm

  3. #3
    Join Date
    Jul 2010
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    Thanks Norm, I will see if that thread can help me out. I should have mentioned the oscillator temp of $41E99BBE is decimal 36.25xxxxxx degs C.

    John

  4. #4
    Join Date
    Jul 2010
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    I give up, how do I get $3FE3586328F97ED5 AND $C000D1A6DD4B949E into the N-Bit Math Value32 variable?

    The above two 64 bit hex numbers reside in an array and represent latitude (34.xxxxxx) and longitude (-120.xxxxxx).

    John

  5. #5
    Join Date
    Feb 2006
    Location
    Gilroy, CA
    Posts
    1,530


    Did you find this post helpful? Yes | No

    Default

    Wow, is your gps accurate to 3.6 inches? I wish mine was.
    http://www.scalerobotics.com

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by N6VMO_ View Post
    I give up, how do I get $3FE3586328F97ED5 AND $C000D1A6DD4B949E into the N-Bit Math Value32 variable?
    What format are they in the array. ASCII hex digits or Binary values?
    Are they always the same length? With padding 0's to the left if lower values?

    And you mean a Value64 variable, right?
    DT

  7. #7
    Join Date
    Jul 2010
    Posts
    12


    Did you find this post helpful? Yes | No

    Default

    Him Darrel,

    The data is stored in ASCII hex digits and are always the same length. Yes, I meant Value64.


    Quote Originally Posted by Darrel Taylor View Post
    What format are they in the array. ASCII hex digits or Binary values?
    Are they always the same length? With padding 0's to the left if lower values?

    And you mean a Value64 variable, right?

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


    Did you find this post helpful? Yes | No

    Default

    Well, assuming you have PBP 2.60, and the number starts at the beginning of the array, you could do this ...
    Code:
    ARRAYREAD  MyArray,[HEX2 Value64(7),HEX2 Value64(6),HEX2 Value64(5),HEX2 Value64(4), _
                        HEX2 Value64(3),HEX2 Value64(2),HEX2 Value64(1),HEX2 Value64(0)]
    You can add a SKIP n, if it starts later in the array.

    HTH,
    DT

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