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,680

    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

  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
    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
    Hi Richard, once again thanks a lot for your kind help and time.

    I work on this very slow, because i need to understand the code, and then i need to test the code every time i change something.

    Now i need to fix the months. Please give me some time. I will upload the code and then we can discuss what might need to be done.

    As i have it in mind, i need to create a label. Under the label i need to speciafy which month has 30 days and which has 31 at the begging. For the month February i need to specify which YEAR is 28 days and which is 29.

    Then i will connect the code:

    Code:
    ay_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
    to the Label which has all the info for each month.

    Is that right?

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

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

    getting the number of day in month can be achieved in a few ways

    simple is lookup
    but resource hungryLOOKUP Index,[Constant{,Constant...}],Var

    lookup month,[0,31,28,31,30,,,,,,,,,,,,,],numberofdays

    an array
    more efficient but uses more sram
    arraywrite ndays,[0,31,28,31,30,,,,,,,,,,,,,]
    numberofdays=ndays[month]


    leap years
    are

    if ((year//4 = 0) and (year//400 !=0))
    if month=2 then numberofdays=numberofdays+1
    endif




    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.

    Hi Richard,

    thanks! i need some time, as at work we need to be prepared for a surgery at a 1 day old baby. I have to design the heart model for pre-surgical planning. But this weekend i will try to fix the code with either lookup or arrays .

  5. #5
    Join Date
    Oct 2010
    Posts
    413

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

    i try to understand the "Arraywrite".

    So we that command, we set the Months from January to December with values (how many days each months have).

    Please let me undestand if that is right:

    At the beggining of the program i need to create an array called 'ndays'

    Code:
    ndays   VAR    BYTE [12] 'create an array with 12 byte location for months values
    Then i might need to create an ALIAS the location for each month?

    Code:
    January  VAR   ndays[0]
    February  VAR   ndays[1]
    March  VAR   ndays[2]
    April  VAR   ndays[3]
    May  VAR   ndays[4]
    June  VAR   ndays[5]
    July  VAR   ndays[6]
    August  VAR   ndays[7]
    September  VAR   ndays[8]
    October  VAR   ndays[9]
    November  VAR   ndays[10]
    December  VAR   ndays[11]
    But i guess that i need to specify somewhere how many days each month have.

    Code:
    nday[0] = 31
    ndays[1] = 28
    ndays[2] = 31
    ndays[3] = 30
    ndays[4] = 31
    ndays[5] = 30
    ndays[6] = 31
    ndays[7] = 31
    ndays[8] = 30
    ndays[9] = 31
    ndays[10] = 30
    ndays[11] = 31
    Up to here is that right?

  6. #6
    Join Date
    May 2013
    Location
    australia
    Posts
    2,680

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

    ndays VAR BYTE [13] 'create an array with 12 byte location for months values
    nday[0] = 0
    nday[1] = 31
    ndays[2] = 28
    ndays[3] = 31
    ......
    ndays[11] = 30
    ndays[12] = 31

    ps its easier to arraywrite ndays,[0,31,28....]


    reason , when you get the month from the nmea sentence you will store the month as a number from 1 to 12
    for the sake of one byte why add the complication of needing to calculate an offset into the lookup table ?

    num_days_this_mth = ndays[month] where month = 1 to 12

    January VAR ndays[0]
    February VAR ndays[1]
    March VAR ndays[2]
    April VAR ndays[3]
    May VAR ndays[4]
    June VAR ndays[5]
    July VAR ndays[6]
    August VAR ndays[7]
    September VAR ndays[8]
    October VAR ndays[9]
    November VAR ndays[10]
    December VAR ndays[11]
    all of these aliases are just a pointless typing exercise ,unless you have something else in mind for them
    Last edited by richard; - 3rd June 2018 at 00:39.
    Warning I'm not a teacher

  7. #7
    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
    ndays VAR BYTE [13] 'create an array with 12 byte location for months values
    nday[0] = 0
    nday[1] = 31
    ndays[2] = 28
    ndays[3] = 31
    ......
    ndays[11] = 30
    ndays[12] = 31

    ps its easier to arraywrite ndays,[0,31,28....]


    reason , when you get the month from the nmea sentence you will store the month as a number from 1 to 12
    for the sake of one byte why add the complication of needing to calculate an offset into the lookup table ?

    num_days_this_mth = ndays[month] where month = 1 to 12


    all of these aliases are just a pointless typing exercise ,unless you have something else in mind for them
    For now,i wont use the Aliases, i thought i could use the name instead of the numbers.

    Apart from that i think i need to read more about arraywrite and see more examples if there are in this forum.

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