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
    Dec 2011
    Location
    IO93ok
    Posts
    190

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

    Hi all,

    I have some idea but maths is not my strong point. I have written what I considered to be the process but not a working code. Am I on the right lines ?(See end)

    This is the relevant information to achieve the locator.

    .
    Longitude is always the first, followed by latitude, for each pair. For simplicity, let's assume that West and South are negative lat/long, as is a common convention. For example purposes, I'm going to use 32.123 W, 14.321 N. The key thing is to do the following.:
    Longitude
    1. Add 180 to the longitude, and take the integer value /20, and add one. Then figure out which letter of the alphabet that corresponds to, usually written in upper case. The example will be 147.877/20=7. Adding one will give the 8th letter of the alphabet, or G. Note 7.877 is remaining.
    2. Take the remainder of what is left, and divide by 2, rounding down. This is the number, no conversion required. The example will give a value of 3. Note 1.877 is remaining.
    3. Take the remainder that is left, and multiply by 12, and add one. Round down to the nearest integer.. This is the letter of the alphabet, usually written in lower case. The example gives a value of 22+1=23. This will be the letter w.
    Latitude
    1. Add 90 to the latitude, and take the integer value /10, and add one. Then figure out which letter of the alphabet that corresponds to, usually written in upper case. The example will be 104.321/10=10. Adding one will give the 8th letter of the alphabet, or J. Note 4.321 is remaining.
    2. Take the remainder of what is left, and round down. This is the number, no conversion required. The example will give a value of 4. Note 0.321 is remaining.
    3. Take the remainder that is left, and multiply by 24, and add one. Round down to the nearest integer.. This is the letter of the alphabet, usually written in lower case. The example gives a value of 7+1=8. This will be the letter g.
    Putting them together by pairs, and alternating first longitude then latitude, gives the grid square for 32.123 W, 14.321 N to be GJ34wg.

    I have the info from the RMC string as :-

    Code:
    latdeg VAR BYTE 'degrees latitude
    latmin VAR BYTE 'minutes latitude
    NS VAR BYTE 'north or south
    londeg VAR BYTE 'degrees longitude
    lonmin VAR BYTE 'minutes longitude
    EO VAR BYTE 'east or west
    My idea of the process is something like this :-

    Code:
    locator:
         lonloc1=londeg + lonmin + 180
         lonloc2=lonloc1/20
         lonloc3=lonloc1//20
         maid1=lonloc2+1
         lookup maid1    ; first main letter
         
         lonloc4=lonloc3//2
         maid3=lonloc3/2     ;first number
         
         
         maid5=lonloc4*12+1
         lookup maid5      ; 1st  2nd letter
         
         
         
         latloc1=latdeg + latmin + 90
         latloc2=latloc1/10+1
         latloc3=latloc1//10
         maid1=latloc2+1
         lookup maid2    ; second main letter
         
         
         maid4=latloc3     ; second number
         
         
         maid6=latloc3*24+1
         lookup maid6      ; 2nd 2nd letter
         
         maidenhead=maid1, maid2, maid3, maid4, maid5, maid6

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

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

    Weird - I've had this one on my list of things to make for about a year - I got a bit of a start, then other things took over.

    Don't know if this helps, but HERE is a BASIC program that I was going to try to convert.

    If I get going on this again, I'll keep you updated - and please let me know how you're doing with it too.

    Andy
    "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.

    OK thanks for that I will look at it.

    Meanwhile here is the full code i have for getting the NMEA data I want to display. NOTE the code for maidenhead is the same as above, a work in progress. All untested as yet.
    I do have a fully working code in asm but wanted it in PBP for experimental purposes.

    Code:
    '
    ' Program to display returned value of a GPS on RB0
    ' LCD in 4-BIT mode PIC16F628 controller 4Mhz clock Fuse PWRT BODEN
    ' 
    'GPS sentence: $GPRMC,192144.62,A,5041.6058,N,00412.6124,E,0.45,3 57.74,081205,,*0B
    
    Define LCD_DREG PORTA          ' Port for LCD Data
    Define LCD_DBIT 0                   ' Use upper 4 bits of Port  
    Define LCD_RSREG PORTB         ' Port for RegisterSelect (RS) bit
    Define LCD_RSBIT 4                 ' Port Pin for RS bit  (pin9)
    Define LCD_EREG PORTB          ' Port for Enable (E) bit
    Define LCD_EBIT 5                   ' Port Pin for E bit    (pin7)
    Define LCB_BITS 4                   ' Using 4-bit bus
    Define LCD_LINES 4                  ' Using 2 line Display
    Define LCD_COMMANDUS 2000      ' Command Delay (uS)
    define LCD_DATAUS 50              ' Data Delay (uS)
    
    DEFINE OSC 4
    CMCON = 7
    OPTION_REG.7=0                 ' Enable Pull-Up's
    GPSin VAR PORTB.0
    LED  VAR PortA.4               ' flash per second
    
    TRISA.0=0
    TRISA.1=0
    TRISA.2=0
    TRISA.3=0
    
    TRISA.4=0 ; LED
    
    PAUSE 500
    
    PORTA=0
    PORTB=0
    
    'Allocate Variables for GPS:
    TimeOut CON 3000
    baudGPS CON 24764 '16572 + 8192 (bit 13)
    
    hh VAR BYTE           'hours
    mm VAR BYTE          'minutes
    knots VAR WORD     'speed in knots (units)
    knotsten VAR BYTE   'speed in knots (tens)
    course VAR WORD    'heading
    latdeg VAR BYTE      'degrees latitude
    latmin VAR BYTE      'minutes latitude
    NS VAR BYTE          'north or south
    londeg VAR BYTE     'degrees longitude
    lonmin VAR BYTE     'minutes longitude
    EO VAR BYTE          'east or west
    j VAR BYTE             'day
    m VAR BYTE            'month
    a VAR BYTE            'year
    
    fix VAR WORD        'GPS fix
    
    
    LCDOut $FE, 1        'Clear Screen
    
    LCDOut $fe,$80," GPS Decoder "
    LCDOut $FE,$c0, " G8VLQ "
    Pause 2000
    LCDOut $FE, 1  
    
    GPS:                 'read GPS
    
    SerIn2 GPSin,baudGPS,Timeout,[wait("$GPRMC"),wait(","),DEC2 hh,DEC2 mm,wait(","),fix,wait(","),DEC2 latdeg,DEC2 latmin,wait(","),NS,wait(","),DEC3 londeg,DEC2 lonmin,wait(","),EO,wait(","),knots,wait("."),DEC2 knotsten,wait(","),DEC3 course,wait(","),DEC2 j,DEC2 m,DEC2 a]
    
    flash:                       ;not accurate pps
    led high
    led low
    
    
    IF fix="V" Then                                            'if no GPS fix
    GOTO LCD1
    EndIF
    
    LCD:                  ; LATER put time and date on first line , remove names
                             ; callsign and QRA (maidenhead) on second line
    
    LCDOut $fe,$80,"DATE: ",DEC2 j,"-",DEC2 m,"-",DEC2 a                                     ; 80 1st line   
    LCDOUT $fe,$c0,"TIME: ",DEC2 hh,":",DEC2 mm                                                 ; c0 2nd line
    LCDOut $fe,$94,"LAT:",DEC2 latdeg,",",DEC2 latmin," ",NS                                  ; 94 3rd line
    LCDOut $fe,$d4,"LON:",DEC2 londeg,",",DEC2 lonmin," ",EO                                ; d4 4th line
    
    GoTo GPS
    
    LCD1:                       ; If invalid data, just shows gps string is received
    
    LCDOut $fe,$80,"  Invalid data  "                                                                       ; 80 1st line
    LCDOUT $fe,$c0,"     No Fix     "                                                                       ; c0 2nd line
    LCDOut $fe,$94,"LAT:",DEC2 latdeg,",",DEC2 latmin," ",NS                                 ; 94 3rd line
    LCDOut $fe,$d4,"LON:",DEC2 londeg,",",DEC2 lonmin," ",EO                                ; d4 4th line
    
    GoTo GPS
    
    locator:
         lonloc1=londeg + lonmin + 180
         lonloc2=lonloc1/20
         lonloc3=lonloc1//20
         maid1=lonloc2+1
         lookup maid1                         ; first main letter
         
         lonloc4=lonloc3//2
         maid3=lonloc3/2                      ;first number
         
         
         maid5=lonloc4*12+1
         lookup maid5                         ; 1st  2nd letter
         
         
         
         latloc1=latdeg + latmin + 90
         latloc2=latloc1/10+1
         latloc3=latloc1//10
         maid1=latloc2+1
         lookup maid2                         ; second main letter
         
         
         maid4=latloc3                        ; second number
         
         
         maid6=latloc3*24+1
         lookup maid6                         ; 2nd 2nd letter
         
         maidenhead=maid1, maid2, maid3, maid4, maid5, maid6
         
          
    
    speed:
    LCDOUT $fe,1
    LCDOut $fe,$80,"SPEED :",knots,".",DEC2 knotsten," KNT"
    LCDOut $fe,$c0,"HEADING:",DEC3 course," DEG"
    
    END
    Last edited by tasmod; - 6th March 2014 at 08:54. Reason: spelling

  4. #4
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    157

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

    Thanks! I'll have a look at that.
    "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

  5. #5
    Join Date
    Jan 2012
    Location
    Grid EN19MV
    Posts
    157

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

    BTW, what are you building? Mine was an idea when I was driving around talking on Amateur Radio Satellites. We were in Grand Forks, North Dakota, and I was waiting for my wife to come out of a store. There happened to be an AO-51 pass happening right then, so I made a couple of contacts - only I had NO IDEA what my grid square was! I used my Winnipeg one, and thought "it would be nice to have a handheld, GPS-based unit that displays your current grid square to 6 digits". And the idea was born. I'll get to it, probably right after I finish the smoker controller I'm working on right now.

    Did you happen to notice how I list my location on the forum? I guess great minds really DO think alike!

    Andy
    Last edited by andywpg; - 8th March 2014 at 19:37. Reason: spelling
    "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

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

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

    Hi Andy,

    The project is already working, I just wanted more information displayed on LCD. The LCD board piggybacks the LCD display. It has a 16F818 which deals with the NMEA string and ADC functions.

    It's a GPS Disciplined Oscillator producing 10MHz to 10-12 signal. For accuracy of frequency and timing for MS and EME.

    It remains extremely stable but I am slightly improving it by logging the PLL control voltage and the TCXO temp swing.
    By logging I can get a mean control position for either start up purposes or short term 'dropout' from gps. Thus it will keep accuracy for short term outage. If the unit is turned off then on, I can apply the correct PLL control voltage until the gps locks again. Although watching the PLL voltage swing whilst trying to lock was fascinating.

    It also produces a very accurate 1PPS output. I later intend to use this to trigger the NMEA sentence display. You may be aware that the sentence suffers from lag or slight offset depending if the gps module decides to send another, other, information sentence. In my case at the moment it is 1.635 secs BEHIND actual time as my module occasionally sends out the powerID string which puts the timing RMC sentence out.
    I will be turning all off except the RMC sentence. At the moment it is testing phase.

    I get a very strong signal from the 60kHz time signal from Anthorn in the UK so I can actually compare the second epoch via SpecLab software visually.
    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, 17:37
  2. Need Info for PBP?
    By azmax100 in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 30th January 2009, 08:44
  3. Replies: 1
    Last Post: - 27th July 2008, 07:14
  4. dmx info.
    By oscar in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 8th May 2005, 12:54

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