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
    May 2013
    Location
    australia
    Posts
    2,653

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

    if your time offset from utc is 3.00 hours then the minutes and seconds are irrelevant.
    after adding your offset then you need to check if the new hours is >23
    if so then add a day to the date then test if that is greater
    than the number of days for that month [ don't forget leap years / leap centuries],
    then increment the month if there are too many days
    you may even need to increment the year , not forgetting to set the new day/month to the appropriate value after all
    the incrementing and the new hour to modulo 24

    better still get a raspberry pi use python datetime
    now=datetime.datetime.utcnow()+datetime.timedelta( hours=3)
    and it does everything in one line
    Last edited by richard; - 26th May 2018 at 16:24. Reason: fixed datetime
    Warning I'm not a teacher

  2. #2
    Join Date
    Oct 2010
    Posts
    413

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

    Quote Originally Posted by richard View Post
    if your time offset from utc is 3.00 hours then the minutes and seconds are irrelevant.
    after adding your offset then you need to check if the new hours is >23
    if so then add a day to the date then test if that is greater
    than the number of days for that month [ don't forget leap years / leap centuries],
    then increment the month if there are too many days
    you may even need to increment the year , not forgetting to set the new day/month to the appropriate value after all
    the incrementing and the new hour to modulo 24

    better still get a raspberry pi use python datetime
    now=datetime.datetime.utcnow()+datetime.timedelta( hours=3)
    and it does everything in one line
    ok im trying now to understand your logic which is clear but for me a bit difficult to transfer it to code.

    Lets start.

    if your time offset from utc is 3.00 hours then the minutes and seconds are irrelevant.

    hh = hh +3
    hh = hh//24
    after adding your offset then you need to check if the new hours is >23

    if hh > 23
    At the next sentense i have a difficulty to understand how to write the code.
    if so then add a day to the date then test if that is greater

    DAY = DAY +1
    My understanding is, that when the
    hh > 23
    then with the command
    DAY = DAY + 1
    we see the change only if numerically the Hour goes to 24.

    But we said that hh will not exceed the number 23, after that and correctly will go to 00.

    So i need to find the way to tell the code that every time hh goes to 00 to change the date. And keep the same value until the next change to 00, so the date will change forward again.

    I might need a help here again.

    better still get a raspberry pi use python datetime
    now=datetime.datetime.utcnow()+datetime.timedelta( hours=3)
    and it does everything in one line
    I'm thinking to get either a rasbery pi or arduino pro. I see all amature programmers goes there because coding and labraries are available everywhere.

    I will try to picbasic pro here, but i dont understand why there is no categorized code and libraries available for doing our lifes easier, and with that way we also learn faster.

    anyway as i said in the begging im an amature in programming and is not my main job. I do it on my spare time and i try to make as simple as possible.
    Last edited by astanapane; - 27th May 2018 at 12:41.

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653

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

    hh = hh +3
    if hh>23 then
    day_added = true
    endif
    hh = hh//24
    .............

    if day_added then
    day = day +1
    if day > numberofdayforthismonth then
    day=1
    month=month +1
    if month >12 then
    month=1
    year=year+1
    endif
    endifendifendifendifendifendif lots of endifs
    Last edited by richard; - 27th May 2018 at 12:46.
    Warning I'm not a teacher

  4. #4
    Join Date
    Oct 2010
    Posts
    413

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

    Quote Originally Posted by richard View Post
    hh = hh +3
    if hh>23 then
    day_added = true
    endif
    hh = hh//24
    .............

    if day_added then
    day = day +1
    if day > numberofdayforthismonth then
    day=1
    month=month +1
    if month >12 then
    month=1
    year=year+1
    endif
    endifendifendifendifendifendif lots of endifs
    Hi Richard that is really useful info. Now at this stage i have to make it work. I will set some vars first.

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653

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

    anyway as i said in the begging im an amature in programming and is not my main job. I do it on my spare time and i try to make as simple as possible
    you may think your way is as simple as possible but its not , its the hardest way by far.
    my way breaks the task up into simple logical blocks , each task can then be solved independently ,and in isolation from the other tasks
    the entire project can be built one task at a time

    task1
    read in nmea scentence
    task2
    verify crc
    task3
    identify scentence type
    task 4
    parse a GPRMC scentence

    task4a
    process a time field

    task4b
    process a LAT field
    task4c
    process a LON field

    .....etc

    simple small steps
    Warning I'm not a teacher

  6. #6
    Join Date
    Oct 2010
    Posts
    413

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

    Quote Originally Posted by richard View Post
    you may think your way is as simple as possible but its not , its the hardest way by far.
    my way breaks the task up into simple logical blocks , each task can then be solved independently ,and in isolation from the other tasks
    the entire project can be built one task at a time

    task1
    read in nmea scentence
    task2
    verify crc
    task3
    identify scentence type
    task 4
    parse a GPRMC scentence

    task4a
    process a time field

    task4b
    process a LAT field
    task4c
    process a LON field

    .....etc

    simple small steps
    Ok if i cannot make it the way i have started, i will follow your advice, as given above.

  7. #7
    Join Date
    Oct 2010
    Posts
    413

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

    Hi Richard,

    i think it is working. I need to test it one or two days....

    I'll keep you updated because i need also to understand the "true" statement.

  8. #8
    Join Date
    Oct 2010
    Posts
    413

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

    Sorry forgot to upload the code.

    The following is the one i have changed in order the date to change when the time is > 23

    Code:
    day_added = 0
    hh = hh + 3
    if  hh > 23 then
    day_added = 1
    endif
    hh = hh//24
    if day_added = 1 then
    day = day + 1
    if day > num_date then ; i havent done anything to this up to now. I need to figure out how to tell the programm about the num_date (No of the day today in this month)
    day = 1
    if month > 12 then
    month = 1
    year = year +1
        endif
          endif
            endif
    regarding this
    Code:
    if day > num_date then ; i havent done anything to this up to now. I need to figure out how to tell the programm about the num_date (No of the day today in this month)
    i think that i need to create a table with 12 months and specify which has 30, 31, or which year then has Feb 28 or 29
    Attached Files Attached Files

  9. #9
    Join Date
    May 2013
    Location
    australia
    Posts
    2,653

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

    the only thing I might add is that the conversion from utc to local time only needs to be done if and when the hour changes , its not needed in every loop.
    a flag can be set when the utc hour now is != current utc hour , then the flag can be cleared when the conversion is done
    Warning I'm not a teacher

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 : 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