How do I discern Maidenhead Locator from GPS lat long info.


Closed Thread
Results 1 to 40 of 126

Hybrid View

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

    Default Re: How do I discern Maidenhead Locator from GPS lat long info.

    Thanks Rob, that is helpful.
    But the routines from the pearl script don't leave the variables in the right state to do the last part.

    I'm trying to recreate it in a spreadsheet to see what values the variables should have at that point.
    But finding time to look at it is difficult right now.

    Just wanted to let you know I'm still working on it.
    DT

  2. #2
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    159

    Default Re: How do I discern Maidenhead Locator from GPS lat long info.

    Quote Originally Posted by Darrel Taylor View Post
    I'm trying to recreate it in a spreadsheet to see what values the variables should have at that point.
    But finding time to look at it is difficult right now.
    Don't know if THIS PDF will help - but I was using this in my early attempts to get this figured out. It describes how to discern the 7th and 8th digits
    "I have noticed that even those who assert that everything is predestined and that
    we can change nothing about it still look both ways before they cross the street"


    -Stephen Hawking

  3. #3
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190

    Default Re: How do I discern Maidenhead Locator from GPS lat long info.

    Hi Darrel,

    Many thanks for this.

    I wondered about the variables. I did have a try at following the code through in the hope I could perhaps work it out.

    As a test. I changed the string to 8 characters and tried adding MH(7) ="0" + AINT/10 and MH(8)="0"+ AINT/10 in Lat and Lon routines after MH4 and MH5 as a trial to see what was displayed.

    I think the routine at 8 chrs is referencing the midi digit routine chrs as it displays custom chrs on the LCD in those positions.

    I tried repeating MH4 and 5 but renumbered, so that should give 'IO93okok' as the 7th and 8th position but again it accessed custom chrs. A puzzle for me anyway.
    Rob.

    The moment after you press "Post" is the moment you actually see the typso

  4. #4
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190

    Default Re: How do I discern Maidenhead Locator from GPS lat long info.

    Hi Andy,

    That's the doc I took the info post from

    Regarding working satellites, I downloaded a Maidenhead Locator App for my Android phone. Gives lots of other info too.
    Able to get 10 digit locator from the inbuilt gps on the phone.
    Rob.

    The moment after you press "Post" is the moment you actually see the typso

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

    Default Re: How do I discern Maidenhead Locator from GPS lat long info.

    Quote Originally Posted by tasmod View Post
    Able to get 10 digit locator from the inbuilt gps on the phone.
    Not sure if the fifth pair is also a 10x10 subdivision, since the PDF only does 8 characters.
    But continuing the logic to the next pair, I'm getting that your 10 digit locator is ... IO93ok03ed

    Does your Android App give a similar location?
    DT

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

    Default Re: How do I discern Maidenhead Locator from GPS lat long info.

    Nope, it's 24x24.
    And your 10-digit locator is IO93ok03kh.

    This version is quite different from the last one.
    I've tossed out the stuff that came from the pearl script and did it like the PDF mentioned above.

    It has to use the 32-bit floating point routines now. 24-bits just didn't have enough resolution for the sub-squares.
    While this version is more efficient, it's also harder to understand, sorry.

    Code:
    ; Filename    : Maidenhead_10.pbp
    ; Compiler    : PICBASIC PRO Compiler
    ; Target PIC  : 16F1937, but will work with most any chip
    ; Oscillator  : ANY
    ; Keywords    : Maidenhead, Locator, GPS, Amateure Radio
    ; Description : PICBASIC PRO program to convert between
    ;             : GPS Sexagesimal to Maidenhead coordinate systems
    ;-------------------------------------------------------------------------------
                           ; Must use the 32-bit Floating Point routines
    INCLUDE "FP2032.bas"   ; 32-bit Floating Point for 14-bit cores with RAM at $20
    
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
    DEFINE HSER_SPBRG 25  ' 19200 Baud @ 32MHz, 0.16%
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    
    HSEROUT [27,"[2J","Maidenhead Locator",13,10]
    HSEROUT ["16F1937, 32-bit Floating Point",13,10,13,10]
    
    MH        VAR BYTE[10]
    LonStr    VAR BYTE[12]
    LatStr    VAR BYTE[12]
    LonDeg    VAR BYTE
    LonMin    VAR BYTE
    LonMinDec VAR BYTE
    LonDir    VAR BYTE
    LatDeg    VAR BYTE
    LatMin    VAR BYTE
    LatMinDec VAR BYTE
    LatDir    VAR BYTE
    Idx       VAR BYTE
    AddChar   VAR BYTE
    Divisor   VAR BYTE[4]
    AARG_SAVE VAR BYTE[4]
    
    ;-------------------------------------------------------------------------------
    ASM
    MOVE?CF32  macro C, F       ; put a Floating Point Constant in an FP variable
        MOVE?CW  (C & 0xFFFF), F
        MOVE?CW  (C >> 16), F + 2
      endm
    
    MOVE?FF32  macro Fin, Fout  ; Copy an FP var to another FP var
        MOVE?WW  Fin, Fout
        MOVE?WW  Fin + 2, Fout + 2
      endm
    ENDASM
    ;-------------------------------------------------------------------------------
    
    ARRAYWRITE LonStr,["00049.77,W",0]  ;  0° 47.70'  ;<-- enter GPS location here
    ARRAYWRITE LatStr,["5325.83,N",0]   ; 53° 26.20'
    
    HSEROUT ["LonStr  = ", STR LonStr,13,10]          ; display manual input
    HSEROUT ["LatStr  = ", STR LatStr,13,10]
    
    ;----[parse strings as if they came from a GPS]---------------------------------
    ARRAYREAD LonStr,[DEC3 LonDeg, DEC2 LonMin, Dec LonMinDec, LonDir]
    ARRAYREAD LatStr,[DEC2 LatDeg, DEC2 LatMin, Dec LatMinDec, LatDir]
    
    
    ;----[convert Longitude Sexagesimal to Decimal Degrees]-------------------------
    Aint = LonMinDec : GOSUB ItoFA    ; decimal portion of Minutes
    Bint = 100 : GOSUB ItoFB          ; divided by 100
    GOSUB fpdiv
    Bint = LonMin : GOSUB ItoFB       ; add whole portion of Minutes
    GOSUB fpadd
    Bint = 60 : GOSUB ItoFB           ; divide by 60
    GOSUB fpdiv
    Bint = LonDeg : GOSUB ItoFB       ; add degrees
    GOSUB fpadd
    IF LonDir = "W" THEN              ; if west of Prime Meridian
        @ MOVE?FF32 AARGB2, BARGB2    ; copy Float AARG to BARG
        Aint = 0    : GOSUB ItoFA     ; subtract from 0 to negate
        GOSUB fpsub
    ENDIF
    
    Bint = 180  : GOSUB ItoFB         ; add 180
    GOSUB fpadd
    
    ;----[Have Longitude in AARG as Float]------------------------------------------
    FOR Idx = 0 TO 8 STEP 2
        SELECT CASE Idx
          CASE 0 : AddChar = "A"
                   @ MOVE?CF32 0x83200000, _Divisor   ; 20
          CASE 2 : AddChar = "0"
                   @ MOVE?CF32 0x80000000, _Divisor   ; 2
          CASE 4 : AddChar = "a"
                   @ MOVE?CF32 0x7B2AAAAB, _Divisor   ; 0.0833333
          CASE 6 : AddChar = "0"
                   @ MOVE?CF32 0x78088889, _Divisor   ; 0.00833333
          CASE 8 : AddChar = "a"
                   @ MOVE?CF32 0x73360B61, _Divisor   ; 0.000347222
        END SELECT
        GOSUB MH_Digit
    NEXT Idx
    
    ;----[convert Latitude Sexagesimal to Decimal Degrees]--------------------------
    Aint = LatMinDec : GOSUB ItoFA    ; decimal portion of Minutes
    Bint = 100 : GOSUB ItoFB          ; divided by 100
    GOSUB fpdiv
    Bint = LatMin : GOSUB ItoFB       ; add whole portion of Minutes
    GOSUB fpadd
    Bint = 60 : GOSUB ItoFB           ; divide by 60
    GOSUB fpdiv
    Bint = LatDeg : GOSUB ItoFB       ; add degrees
    GOSUB fpadd
    IF LatDir = "S" THEN              ; if south of equator
        @ MOVE?FF32 AARGB2, BARGB2    ; copy Float AARG to BARG
        Aint = 0    : GOSUB ItoFA     ; subtract from 0 to negate
        GOSUB fpsub
    ENDIF
    
    Bint = 90  : GOSUB ItoFB          ; add 90
    GOSUB fpadd
    
    ;----[Have Latitude  in AARG as Float]------------------------------------------
    FOR Idx = 1 TO 9 STEP 2
        SELECT CASE Idx
          CASE 1 : AddChar = "A"
                   @ MOVE?CF32 0x82200000, _Divisor   ; 10
          CASE 3 : AddChar = "0"
                   @ MOVE?CF32 0x7F000000, _Divisor   ; 1
          CASE 5 : AddChar = "a"
                   @ MOVE?CF32 0x7A2AAAAB, _Divisor   ; 0.0416666
          CASE 7 : AddChar = "0"
                   @ MOVE?CF32 0x770882F1, _Divisor   ; 0.00416666
          CASE 9 : AddChar = "a"
                   @ MOVE?CF32 0x723603EC, _Divisor   ; 0.000173583
        END SELECT
        GOSUB MH_Digit
    NEXT Idx
    ;----[Maidenhead conversion complete]-------------------------------------------
    
    HSEROUT ["LOC ",STR MH\10,13,10,13,10] ; show final result
    
    Main:                             ; blink an LED when done
        HIGH PORTA.0
        PAUSE 500
        LOW PORTA.0
        PAUSE 500
    GOTO Main
    
    ;----[Calculate one digit of the Maidenhead Locator]----------------------------
    MH_Digit:
        @ MOVE?FF32 _Divisor, BARGB2      ; put divisor in BARG
        GOSUB fpdiv                       ; do the divide
        @ MOVE?FF32 AARGB2, _AARG_SAVE    ; save AARG for modulus
    
        GOSUB FtoIA                       ; get integer
        MH(Idx) = Aint + AddChar          ; The Character
        Bint = Aint                       ; copy integer result to BARG
        GOSUB ItoFB                       ; convert it to float
        @ MOVE?FF32 _AARG_SAVE, AARGB2    ; restore previous AARG
        GOSUB fpsub                       ; subtract integer
    
        @ MOVE?FF32 _Divisor, BARGB2      ; multiply times original divisor
        GOSUB fpmul                       ; AARG now contains the remainder
    RETURN
    The output of the program looks like this ...
    Code:
    Maidenhead Locator
    16F1937, 32-bit Floating Point
    
    LonStr  = 00049.77,W
    LatStr  = 5325.83,N
    LOC IO93ok03kh
    BTW: Those are really small squares (in red).

    Name:  IO93ok03kh.jpg
Views: 2391
Size:  18.5 KB
    Last edited by Darrel Taylor; - 20th April 2014 at 08:05.
    DT

  7. #7
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190

    Default Re: How do I discern Maidenhead Locator from GPS lat long info.

    Wow, wow and WOW. What can I say? That is your usual brilliant stuff.

    I use DT_Ints, Big Digits, ADC Average and now your Locator code.

    Many many thanks. I tried but just can't follow it through as you expected

    I never realised just how small the final location square was. That's half my plot. Reason is, the gps antenna is on the window ledge on a back room!
    If I move to front room it would change !! Stunning.

    Now I need to re-organise the screen layout. I didn't think I would run out of room on a 20x4 display.

    I will post a picture of the completed item, it's boxed but not quite complete.

    Once again, many thanks.
    Rob.

    The moment after you press "Post" is the moment you actually see the typso

Similar Threads

  1. LAT replaces PORT command?
    By markscotford in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 3rd December 2011, 16:37
  2. Need Info for PBP?
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 30th January 2009, 07:44
  3. Replies: 1
    Last Post: - 27th July 2008, 06:14
  4. dmx info.
    By oscar in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 8th May 2005, 11:54

Members who have read this thread : 0

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