+ Reply to Thread
Page 3 of 4 FirstFirst 1234 LastLast
Results 81 to 120 of 126
  1. #81

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

    Quote Originally Posted by richard View Post
    I have found that inline math for lcdout cmd on a pic16 turns to crap, serout2 may have the same issues

    you probably need to do the math first then print result

    i would do it this way

    hh=hh+3 ;utc+3
    hh=hh//24 ;REALLY SHOULD ADD A DAY TO DATE TOO IF day changes
    serout2 lcd,32,[$73,$00,$04,$00,$FF,$E0," TIME: ",dec2 hh," :",dec2 mm," :",dec2 ss,$00]
    pause 100
    Richard, really appreciate your help and time.

    Placing the math
    Code:
    hh = hh +3
    hh = hh//24
    before the actual command

    Code:
    serout2  lcd,32,[$73,$00,$04,$00,$FF,$E0,"  TIME: ",dec2 hh," :",dec2 mm," :",dec2 ss,$00]
    it solves the time UTC to local time, and the time when goes at 24 then aytomatically shows 00:

    Now i'm working on that point when time is 23:59:59 at the next second to change the date.

    As i think,it supose to be like that:
    Code:
    if hh = 23 : mm = 59 : ss = 59 
    then DAY = DAY +1
    But then when the Month has only 30 days or 28, we need to specify each month in order to fix the right values and set the parameters.
    Last edited by astanapane; - 26th May 2018 at 14:32.

  2. #82
    Join Date
    May 2013
    Location
    australia
    Posts
    1,425

    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
    This is more entertaining than Free to Air TV

  3. #83

    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.

  4. #84
    Join Date
    May 2013
    Location
    australia
    Posts
    1,425

    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.
    This is more entertaining than Free to Air TV

  5. #85
    Join Date
    May 2013
    Location
    australia
    Posts
    1,425

    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
    This is more entertaining than Free to Air TV

  6. #86

    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.

  7. #87

    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.

  8. #88

    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.

  9. #89

    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

  10. #90
    Join Date
    May 2013
    Location
    australia
    Posts
    1,425

    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
    This is more entertaining than Free to Air TV

  11. #91

    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?

  12. #92
    Join Date
    May 2013
    Location
    australia
    Posts
    1,425

    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




    This is more entertaining than Free to Air TV

  13. #93

    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 .

  14. #94

    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?

  15. #95
    Join Date
    May 2013
    Location
    australia
    Posts
    1,425

    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.
    This is more entertaining than Free to Air TV

  16. #96

    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.

  17. #97

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

    ok i have a problem using the command arraywrite, because at the compiler doesnt recognise it and it wont make it CAPITAL and bold

    Code:
    arraywrite ndays,[0,31,28,31,30,31,30,31,31,30,31,30,31]
    numofdays=ndays[month]
    then i tried to use it as well as following

    Code:
    arraywrite ndays,13,NDAY,[0,31,28,31,30,31,30,31,31,30,31,30,31]
    where the NDAY
    Code:
    NDAY:
    ndays[0] = 0
    ndays[1] = 31       'January
    ndays[2] = 28       'February
    ndays[3] = 31       'March
    ndays[4] = 30       'April
    ndays[5] = 31       'May
    ndays[6] = 30       'June
    ndays[7] = 31       'July
    ndays[8] = 31       'August
    ndays[9] = 30       'September
    ndays[10] = 31      'October
    ndays[11] = 30      'November
    ndays[12] = 31      'December
    But no luck, compiler was telling me that there is a syntax error.

    So i tried to use the lookup command

    Code:
    day_added = 0           
    hh = hh + 3             'the Hour from GPS is UTC so for our country in Greece we add +3
    if  hh > 23 then        'if the hh+3 hour is greater than 23 (23:00) then
    day_added = 1           'we check the day added is true
    endif
    hh = hh//24             'but the hour not exceed the 24 so go to 00:00
    if day_added = 1 then   'now if day added is true
    day = day + 1           'then ADD 1 day
    if day > Numofdays then   'if day is greater than the numbers of the days in this month
    lookup month,[0,31,28,31,30,31,30,31,31,30,31,30,31],numofdays 'here it is suppose to look at a table NDAYS for each month
    day = 1                 'then day goes to number 1
    if month > 12 then 'if month is greater than 12 which is December
    month = 1             ' then month will go to 1, January
    year = year +1      ' and the year will increase by 1
    if ((year//4 = 0) and (year//400 != 0)) then
    year = 1
    if month = 2 then numofdays = numofdays + 1
        endif
          endif
            endif
                endif
    But i dont know if code is ok, because i Still havent specified the lookup table.

    One more question. at the following line:
    Code:
    if ((year//4 = 0) and (year//400 != 0))
    the AND in the middle of the statements is says that statement 1 in order to be true , the statement 2 need also to be true. Is that right?

    Because as far as i understand, the statement 1 : year//4 = 0 is that we have every 4 years a leap year, then the statement 2: year//400 !=0 which != is not equal.

    Could you tell me what does the code in this line mean?

    Code:
    if ((year//4 = 0) and (year//400 != 0))
    thanks once again for your time. I know that is difficult for you to explain to someone that tries to understand even the basics. but believe me i search these days in the web for more info about picbasic pro, and in the forum here, but i cannot understand me things because i feel that are not a clear as should be for someone would like to start from zero.

  18. #98
    Join Date
    May 2013
    Location
    australia
    Posts
    1,425

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

    Could you tell me what does the code in this line mean?
    if ((year//4 = 0) and (year//400 != 0))

    https://en.wikipedia.org/wiki/Leap_year



    ok i have a problem using the command arraywrite
    arraywrite ndays,[0,31,28,31,30,31,30,31,31,30,31,30,31]
    numofdays=ndays[month
    what version of pbp , what error
    what actual code , snippets of code are pointless for debugging



    is syntactically correct for PBP3 the byte vars ndays and month also need to have been declared

    eg

    ndays var byte[13]
    month var byte


    your not executing the required steps in any sort of logical order , work out what steps are required then what order the must be done in


    Code:
    day_added = 0           
    hh = hh + 3             'the Hour from GPS is UTC so for our country in Greece we add +3
    if  hh > 23 then        'if the hh+3 hour is greater than 23 (23:00) then
    day_added = 1           'we check the day added is true
    endif
    hh = hh//24             'but the hour not exceed the 24 so go to 00:00
    if day_added = 1 then   'now if day added is true
    day = day + 1           'then ADD 1 day
    if day > Numofdays then   'if day is greater than the numbers of the days in this month
    how can you test if day is greater than the month has before you have looked up how many days the month has ?
    
    lookup month,[0,31,28,31,30,31,30,31,31,30,31,30,31],numofdays 'here it is suppose to look at a table NDAYS for each month
    day = 1                 'then day goes to number 1
    if month > 12 then 'if month is greater than 12 which is December
    month = 1             ' then month will go to 1, January
    year = year +1      ' and the year will increase by 1
    
    
    what is the point of checking if its a leapyear and the month is feb after you have already  tested the number of days for month limit
    if ((year//4 = 0) and (year//400 != 0)) then
    year = 1
    if month = 2 then numofdays = numofdays + 1
        endif
          endif
            endif
                endif
    This is more entertaining than Free to Air TV

  19. #99

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

    Hi Richard,

    i need to thank you again for your time. I'll start from the part of what version am i using.

    It is an old one, Pic Basic Pro 2.5 with MCSP version 3. I got it from a guy who purchased the PBP 3.0 full pack and gave me this one. I really appreciate his help as well. I have the CD and manual no any identification key on it.

    Now with people like you helping here, i'm thinking also to purchase the PBP 3.1 with MCSPX 5. (but i would like to know if i could use one license with two computers) Anyway it is not a place to discuss it right now.

    Lets go to coding now.

    This is a mesh code, because up to now i try to add code for a specific function and then Quote some parts of the code in order to use them later if needed.

    Code:
    '*  Author  : LEONARDO BILALIS                                  *
    '*  Notice  : Copyright (c) 2018 [LEONARDOS BILALIS]            *
    '*          : All Rights Reserved                               *
    '*  Date    : 12/5/2018                                         *
    '*  Version : 1.0                                               *
    '*  Notes   : This is an G.TOP015 G9 MT3333 gps module          * 
    '*          :                                                   *
    '****************************************************************
    
    @ ERRORLEVEL -306 ; this command prevents the compiler to give you a notice of
                      ; crossing page boundary - make sure bits are set 
    
    @ __config _CONFIG1, _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
    
    Include "MODEDEFS.BAS"
    DEFINE OSC 8   
    OSCCON=%01111000     '8 Mhz
    CMCON = 7            'turn comparators off
    ANSEL = 0            'All digital
    PORTB = 0            'make low all ports at B range
    input portb.0        'make input portb.0
    
    '-----------------------------------------------------------------------------/
    '                           [ ULCD 1'44 4D System ]                          /
    '---------------------------------------------------------------------------/
    
    ' "o" degree character is manual created for degree value 
    
    '----------------------------------------------------------------------------/
    '                              [ PIC Variables ]                            /  
    '--------------------------------------------------------------------------/
    
    PWRLED      var     PORTb.1   ; this shows that the initialization is finished
    LCD         var     PORTb.2   ; to LCD operation
    GPS_TX      var     PORTb.0   ; info from GPS 
    GPS_RX      var     PORTb.4   ; COMMANDS TO GPS
    Testled     var     PORTb.5 
    dots        var     byte
    dots = 21
    countremain var     byte      ; we use a countremain to check the incoming from portb.0  
    pause 1000
               
    ;serout2 gps_rx,84, ["$PMTK330,62*1A",13,10]      ' check MTK manual configuration
    
    ' --------------------[ GPS Variables for NMEA sentenses ]---------------------/
    '                                                                             /
    '   $GPRMC,090045.000,A,3823.6645,N,02353.3600,E,0.02,195.80,170518,,,A*62   /
    '   $GNGGA,140405.000,3823.6010,N,02353.3054,E,1,9,0.88,0.8,M,35.9,M,,*40   /
    '                                                                          /
    '-------------------------------------------------------------------------/
    Timeout     con     2000
    hh          var     byte    'hours
    mm          var     byte    'minutes
    ss          var     byte    'seconds  
    sss         var     word    'milisecs
    degrees		VAR     BYTE	'latitude/longitude degrees
    minutes		VAR		BYTE	'latitude/Longitude minutes
    minutesD	VAR		word	'latitude/LONGITUDE DECIMAL MINUTES
    dir       	VAR     BYTE   	' direction (latitude: 0 = N, 1 = S / longitude: 0 = E, 1 = W)
    degrees2	VAR     BYTE	'latitude/longitude degrees
    minutes2	VAR		BYTE	'latitude/Longitude minutes
    minutesD2	VAR		word	'latitude/LONGITUDE DECIMAL MINUTES
    dir2        var     byte    ;direction (latitude: 0 = N, 1 = S / longitude: 0 = E, 1 = W)
    SatNo   	VAR		BYTE	'number of satellites connected
    knots       var     word    'speed over ground
    knots2      var     byte    'speed over ground
    course      var     word    'course
    course2     var     byte    'course
    day         var     byte    'day
    month       var     byte    'month
    year        var     byte    'year
    i           var     word    
    GNRMC       var     word    'protocol
    GNGGA       var     WORD    'protocol
    FIX         var     word    'fix sat V/A
    Modefix     var     byte    'mode fix 1 or 2 or 3 depens
    horizon     var     byte
    precision   var     byte
    meter       var     byte
    METERS      var     byte
    Meters2     var     byte
    Day_added   var     byte
    Numofdays   var     byte            'these are the days of each months
    ndays       var     byte    [13]    'create an array with 13 byte location for Months values
    
    
    ' -------------------------------------------------------------------------/  
    '                          [ LCD Initialization ]                         /
    '------------------------------------------------------------------------/
    high testled
    
    serout2 LCD,32,[$55]      ' uOLED Initialize
    pause 2000
    serout2 lcd,32,[$56,$01]
    pause 1000
    serout2 lcd,32,[$45]      ' clear the lcd
    pause 500
    serout2 lcd,32,[$55]
    pause 500
    serout2 lcd,32,[$45]      ' clesr the lcd
    pause 500
    serout2 lcd,32,[$73,$00,$03,$11,$ff,$ff," Leonardo Bilalis",$00]
    pause 200                       
    serout2 lcd,32,[$73,$02,$06,$10,$ff,"     Copyright 2018",$00]
    pause 3000
    serout2 lcd,32,[$45]
    pause 1000
    serout2 lcd,32,[$73,$02,$06,$10,$ff,$ff,"      GPS.........",$00]
    pause 500
    serout2 lcd,32,[$45]
    pause 200
    
    '----------------------------------------------------------------------/
    '     [ After the lcd initialization we power the Led at PIC ]        /
    '--------------------------------------------------------------------/
    
    HIGH pwrled
    
    '----------------------sent a centence to gps------------------------
    
    'Here i was planning to send a code to the GPS, i will find out the way later once i fix the Calendar part
    
    ;serout gps_rx,84,[$PMTK_103*30,,,] 
    ;pause 100
    
    '-------------------------------------------------------------------/
    '                         [MAIN Program]                           /
    '-----------------------------------------------------------------/
    
    Main: 
    
    '-------------------------------------------------------------------------------/
    '                                                                              /
    '                    [ Example NMEA Sentense of GNRMC ]                       /
    ' [$GNRMC,090045.000,A,3823.6645,N,02353.3600,E,0.02,195.80,170518,,,A*62]   /
    '                                                                           /
    '--------------------------------------------------------------------------/
    serin2  gps_tx,84,timeout,lostcable,[wait("$GNRMC"),_           ;we wait for $GNRMC
    wait(","),dec2 hh,dec2 mm,dec2 ss,wait("."),dec3 sss,_          ;we wait for 090045.000 which is the time when we got the info
    wait(","),fix,_                                                 ;we wait for A
    wait(","),dec2 degrees,dec2 minutes,wait("."),dec4 minutesd,_   ;we wait for 3823.6645
    wait(","),dir,_                                                 ;we wait for N/S 
    wait(","),dec3 degrees2,dec2 minutes2,wait("."),dec4 minutesd2,_;we wait for 02353.3600
    wait(","),dir2,_                                                ;we wait for E/W
    wait(","),SKIP 4,_         ; i also used SKIP command but doesnt look like the compiler identified it as long as is not in Capital / Bold. But seems to be working and compiling the code. 
    wait(","),SKIP 6,_
    wait(","),dec2 day,dec2 month,dec2 year]                        ;we wait for 170518                            
    pause 100
    
    'wait(","),dec1 knots,wait("."),dec2 knots2,_                    ;we wait for 0.02
    'wait(","),dec3 course,wait("."),dec2 course2,_                  ;we wait for 195.80
    
    '------------------------------------------------------------------------------/
    '                                                                             /
    '                     [ Example NMEA Sentense of GNGGA ]                     /
    ' [$GNGGA,140405.000,3823.6010,N,02353.3054,E,1,9,0.88,0.8,M,35.9,M,,*40    /           
    '                                                                          /
    '-------------------------------------------------------------------------/
    
    serin2 gps_tx,84,timeout,lostcable,[wait("$GNGGA"),_            ;we wait for GNGGA
    wait(","),SKIP 37,_
    wait(","),dec2 satno,_
    wait(","),SKIP 19]
    pause 100
    
    ;wait(","),dec2 hh,dec2 mm,dec2 ss,wait("."),dec3 sss,_          ;we wait for 140405.000 which is the time when we got info 
    ;wait(","),dec2 degrees,dec2 minutes,wait("."),dec4 minutesd,_   ;we wait for 3823.6010 longitude
    ;wait(","),dir,_                                                 ;we wait for the N/S
    ;wait(","),dec3 degrees2,dec2 minutes2,wait("."),dec4 minutesd2,_;we wait for 02353.3054 latitude
    ;wait(","),dir2,_                                                ;we wait for E/W
    ;wait(","),modefix,_                                             ;we wait for modefix 1,2 or 3 check gps manual for NMEA
    ;wait(","),dec2 satno,_                                          ;we wait for the number of fixed satellites, this is impoetant info
    ;wait(","),dec3 horizon,dec precision,_                          ;we wait for horizon
    ;wait(","),meter,dec2 METERS,dec Meters2]                        ;we wait for the meters 
    
    
    '---------------------------------------------------------------------------------/
    ' Here if the GPS module havent been fixed to any satellite will jump to notfix  /
    '-------------------------------------------------------------------------------/
    
    if fix = "V" then notfix                                                        
    pause 100
    
    '-----------------------------------------------------------------------------/
    '                           [ Return from notfix ]                           /
    '                   [ We clear any character on the display ]               /
    '--------------------------------------------------------------------------/
    
    serout2 lcd,32,[$45]     'Clear the ulcd 1'44
    pause 500
    
    '-----------------------------------------------------------------------------/
    '                   Here we start the calendar conversion                    /
    '---------------------------------------------------------------------------/
    
    ; arraywrite ndays,13,NDAY,[0,31,28,31,30,31,30,31,31,30,31,30,31] ; This Code doesnt compile as there is a syntax error. 
    ; numofdays=ndays[month]
    
    day_added = 0           
    hh = hh + 3             'the Hour from GPS is UTC so for our country in Greece we add +3
    if  hh > 23 then        'if the hh+3 hour is greater than 23 (23:00) then
    day_added = 1           'we check the day added is true
    endif
    hh = hh//24             'but the hour not exceed the 24 so go to 00:00
    if day_added = 1 then   'now if day added is true
    day = day + 1           'then ADD 1 day
    if day > Numofdays then   'if day is greater than the numbers of the days in this month
    lookup month,[0,31,28,31,30,31,30,31,31,30,31,30,31],numofdays
    day = 1                 'then day goes to number 1
    if month > 12 then      '
    month = 1               'then day goes to number 1
    year = year +1          'and the year will increase by 1
    if ((year//4 = 0) and (year//400 != 0)) then 
    year = 1
    if month = 2 then 
    numofdays = numofdays + 1
        endif
          endif
            endif
                endif
                    endif
                    
           
    '--------------------------------------------------------------------------/
    ' here is where the code dispays the stored info from the NMEA sentenses  /
    '------------------------------------------------------------------------/
                
                    
    serout2 lcd,32,[$73,$03,$00,$00,$FF,$FF," Protocol:","NMEA",$00]
    pause 100
    serout2 lcd,32,[$73,$01,$02,$01,$07,$E0," Date:",dec2 day,"/",dec2 month,"/",dec2 year,$00]
    pause 100
    serout2  lcd,32,[$73,$00,$04,$00,$FF,$E0,"   TIME: ",dec2 hh," :",dec2 mm," :",dec2 ss,$00]
    pause 100
    serout2 lcd,32,[$73,$00,$07,$00,$FF,$FF," Satellites",$00] 
    pause 100
    serout2 lcd,32,[$73,$03,$09,$11,$07,$FF,dec2 satno,$00]
    pause 100
    serout2 lcd,32,[$73,$00,$07,$00,$FF,$FF,"               Fixed",$00]
    pause 100
    serout2 lcd,32,[$73,$0B,$09,$11,$07,$FF,fix," 3D",$00]
    pause 100
    serout2 lcd,32,[$73,$00,$0B,$00,$ff,$ff," Lat : ",dec2 degrees,"*",dec2 minutes,"'",dec4 minutesd,"@"," ",$00]
    pause 100
    serout2 lcd,32,[$73,$BE,$0B,$10,$f8,$00,dir,$00]
    pause 100
    serout2 lcd,32,[$73,$00,$0D,$00,$ff,$ff," Lon :",dec3 degrees2,"*",dec2 minutes2,"'",dec4 minutesd2,"@"," ",$00]
    pause 100
    serout2 lcd,32,[$73,$BE,$0D,$10,$f8,$00,dir2,$00]
    
    ;serout2 lcd,32,[$73,$00,$0C,$00,$ff,$ff,"GND SPEED : ",(dec knots,".",dec2 knots2)*/1.852,$00]
    ;pause 200
    ;serout2 lcd,32,[$73,$00,$0E,$00,$ff,$ff,"Meters : ",dec2 METERS,dec Meters2,$00]
    pause 5000
    serout2 lcd,32,[$45]  ' clears the LCD 
    pause 100
    
            goto main
    
    '-----------------------------------------------------------------------------/
    '                              [ SUB ROUTINES ]                              /
    '---------------------------------------------------------------------------/
    
    '-----------------------------------------------------------------------------/
    '                         [ Calendar days in Months ]                        /
    '---------------------------------------------------------------------------/
    
    'The following i was planning to use it with ARRAYWRITE but cant seem i can get it working. 
    
    NDAY:
    ndays[0] = 0
    ndays[1] = 31       'January
    ndays[2] = 28       'February
    ndays[3] = 31       'March
    ndays[4] = 30       'April
    ndays[5] = 31       'May
    ndays[6] = 30       'June
    ndays[7] = 31       'July
    ndays[8] = 31       'August
    ndays[9] = 30       'September
    ndays[10] = 31      'October
    ndays[11] = 30      'November
    ndays[12] = 31      'December
    '-----------------------------------------------------------------------------/
    '                         [ Waiting for GPS signal ]                         /
    '---------------------------------------------------------------------------/
    
    notfix:     ' Still looking for fixed signal
     
    serout2 lcd,32,[$73,$00,$03,$11,$07,$ff,"   Waiting for GPS",$00]
    pause 100
    hh = hh + 3
    hh = hh//24
    serout2 lcd,32,[$73,$03,$06,$10,$ff,$E0," Time:",dec2 hh," :",dec2 mm," :",dec2 ss,$00]
    pause 1000
    serout2 lcd,32,[$73,$00,$08,$10,$07,$ff,rep "." \dots,$00]
    
    pause 200
    serout2 lcd,32,[$45]  ' clears the LCD 
    pause 100
    
    
    goto main       'returns to main    
    
    '-----------------------------------------------------------------------------/
    '                 [ Connection lost Please check the GPS ]                   /
    '---------------------------------------------------------------------------/
    
    lostcable:
    
    serout2 lcd,32,[$73,$00,$03,$11,$f8,$00,"  Connection lost",$00]
    pause 200
    serout2 lcd,32,[$73,$01,$06,$10,$07,$FF,"  Please check cable",$00]
    pause 2000
    serout2 lcd,32,[$45]  ' clears the LCD 
    pause 100
    
    goto main
    
    '-------------------------------------------------------------------------/
    '                      GREEK TIME and Correcrion                         /
    '-----------------------------------------------------------------------/
    
    ' at the moment this is not connected to any part of the code
    ;Plusthree:
    ;  hh = hh + 3
    ;  IF hh = 25 THEN hh = 0  
    ;RETURN  
    '---------------------------------------------------------------------------/
    '                              [ CLEAR LCD ]                               /
    '-------------------------------------------------------------------------/
    
    Clearlcd:
    serout2 lcd,32,[$45]
    pause 500
    RETURN
    Regarding the following part of the code, MARKED items with RED by Richard i will fix it on my next message. I think it is clear what needs to be done. Thanks once again.

    Code:
    day_added = 0           
    hh = hh + 3             'the Hour from GPS is UTC so for our country in Greece we add +3
    if  hh > 23 then        'if the hh+3 hour is greater than 23 (23:00) then
    day_added = 1           'we check the day added is true
    endif
    hh = hh//24             'but the hour not exceed the 24 so go to 00:00
    if day_added = 1 then   'now if day added is true
    day = day + 1           'then ADD 1 day
    if day > Numofdays then   'if day is greater than the numbers of the days in this month
    how can you test if day is greater than the month has before you have looked up how many days the month has ?
    
    lookup month,[0,31,28,31,30,31,30,31,31,30,31,30,31],numofdays 'here it is suppose to look at a table NDAYS for each month
    day = 1                 'then day goes to number 1
    if month > 12 then 'if month is greater than 12 which is December
    month = 1             ' then month will go to 1, January
    year = year +1      ' and the year will increase by 1
    
    
    what is the point of checking if its a leapyear and the month is feb after you have already  tested the number of days for month limit
    if ((year//4 = 0) and (year//400 != 0)) then
    year = 1
    if month = 2 then numofdays = numofdays + 1
        endif
          endif
            endif
                endif

  20. #100

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

    This weekend i will try to make some changes. I also found out that the NMEA sentence $GPVTG (from a chip MT3339) or $GNVTG (from a chip MT3333, with GLONASS) has the info of the speed in Km/h so it will be simpler to display speed at km/h.

  21. #101

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

    ok it is being some time since i made a change to the code. These days i l was trying to figure out how to embed the speed in my code. I left the part of the code with Days, Months, Years, on a side for a while.

    Tomorrow i will upload the code with the speed embeded, and the limits at 10Km/h, 50Km/h, 100Km/h. I have placed for the indication of each limit some LEDs at A Port.

    I have also noticed that code is expanding, and at the end i might need a bigger PIC chip.
    Last edited by astanapane; - 11th June 2018 at 22:29.

  22. #102

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

    These days i tried to use the $GPVTG sentence and get the speed from there as it is in Km/h

    First of all the format of the $GPVTG sentence is as follows.

    1. X.XX for the left X before the "dot" when the speed is less than 10km/h
    2. XX.XX for the XX before the "dot" when the speed is more than 9 km/h and less than 100km/h
    2. XXX.XX for the XXX before the "dot" when the speed is more than 99km/h

    For the .XX so the two digits after the "dots" those are the decimal part and stays stable in the $GPVTG sentence.

    We need to check when the speed change, where is the dot.

    Code:
    serin2 gps_tx,84,timeout,lostcable,[wait("GPVTG"),wait("N"),_
    wait(","),TS[0],TS[1],TS[2],TS[3],TS[4],_
    wait(","),SKIP 3]
    
    for i = 1 to 3
        if TS[i]="." then decimal = i   'TOTAL SPEED. find which character is the decimal point 
        next i
    
    select case decimal 'if the gps shows 1.45 it may be 145
                        'for the conversion ASCII to number we can use the -48
        case    1       'decimal position is x.xx
            speed = (10*(TS[0]-48))+(TS[2]-48)
        case    2       'decimal position is xx.xx
            speed = (100*(TS[0]-48))+(10*(TS[1]-48))+(TS[3]-48)
        case    3       'decimal position is xxx.xx
            speed = (1000*(TS[0]-48))+(100*(TS[1]-48))+(10*(TS[2]-48))
        end select     
        
    gosub OVERSPEED:
    
    
    OVERSPEED: 
    
    if SPEED > 1000 then     ' 100Km/h
        high porta.3
        low  porta.2
        low  porta.1    
    else
        LOW porta.3
        
    if SPEED > 500 then     ' 50Km/h
        high porta.2
        low  porta.1    
    else
        LOW porta.2
        
    if SPEED > 100  then    ' 10Km/h
        high porta.1
    else
        LOW porta.1
    
    endif
        endif
            endif
        return
    At the moment the code is working as it is, but i think i need to change the multiplication of 10*, 100* and 1000*, to 1*, 10* and 100*, because as you see at the OVERSPEED: i use 1000 for the 100 km/h, 500 for the 50km/h and 100 for the 10km/h.
    But then the dot will change place, or i will not being able to identify the right place of it. Anyhow the code is working for the speed.

    Still i need to:

    1. Make the Day/Month/Year to work properly, now i think i will not have a problem to solve this.

    2. The display data are refreshed, my goal is to make the data stable all the time at the screen and change only the needed values.
    Attached Images Attached Images   

  23. #103

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

    Could you tell me if it is a good choise continuing this project with PIC16f887 i/p?

  24. #104
    Join Date
    May 2013
    Location
    australia
    Posts
    1,425

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

    Could you tell me if it is a good choise continuing this project with PIC16f887
    its basically the same very limited chip you are presently using with a few more pins.
    if you are serious in wanting to calculate maidenhead then no its a poor choice.
    at least get something like 16f18326 ,16f18875 or better still a pic18 chip
    I like pic18f26k42 [if you have pbp3.1] or a pic18f26k22 with pbp3.0 for this sort of project
    This is more entertaining than Free to Air TV

  25. #105

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

    Hi Richard,

    thanks a lot again for your reply. I'm trying to use a chip that i can program with pickit2 as i dont want to spend any money for the pickit 3.

    I'm planning to purchase the PBP3.1 software, than spend for pickit3 hardware. Im happy with pickit 2, and a close supported device as far as i see is the pic18f26k20.

    At the moment in stock i have the pic18f4550, pic16f1939. What is the feature of the pic we are looking for. The CPU SPEED (8bit or 16bit...), the SRAM, timers?

  26. #106
    Join Date
    May 2013
    Location
    australia
    Posts
    1,425

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

    What is the feature of the pic we are looking for. The CPU SPEED (8bit or 16bit...), the SRAM, timers?

    its not my project I don't know what you have planned but generally speaking if you are dealing with parsing strings from a serial stream , more sram is better ,the possibility of more speed is always better. make sure there is plenty of flash space to hold the program. if its a one off project get the best chip with enough pins and features required .
    if you are going to do large amounts of and/or complex math then pic18's with a hardware multiplier can increase speed and
    reduce code size

    pk2 will program 18fk22 series , once you have used a chip with pps there is no going back. the k42 series chips leave the others in the dust
    This is more entertaining than Free to Air TV

  27. #107

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

    thanks for the info once again. Is not a place to analyze it more, and im the one i need to understand better the differences of the chip's performance.

    Last question based on the pps, do you mean pulse per second? OK just checked this, Peripheral pin select

    I've also checked the supported devices from PICkit2 for k22 series : PIC18F13K22 PIC18LF13K22 PIC18F14K22 PIC18LF14K22

    No K42 is supported.
    Last edited by astanapane; - 13th June 2018 at 09:46.

  28. #108
    Join Date
    May 2013
    Location
    australia
    Posts
    1,425

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

    your pk2 device list file is out of date, there are many more k22 chips supported .
    Attached Images Attached Images  
    This is more entertaining than Free to Air TV

  29. #109

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

    ooops i dint know.

    i tried many times to check if there is a newer version and didnt find any that 2.61 with the devicefile 1.61.

    I will check again. thanks for the update really i didnt know it.
    Attached Images Attached Images  

  30. #110

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

    First of all i need to Apologize for my absent.

    Now :

    1. Didnt find and Update for pickit2. Not a problem because i will think to use the following PICs and i see that pickit2 at the moment supports it.

    2. As far as the pic16f88 is limited in ram i need to step up and use a better microcontroller. Im Looking at the PIC18F4550 or PIC18F2550.

    3.The project as i have it in mind need to have an SD in order to store the Data from GPS Nmea.

    I found out that only a microcontroller with 48mhz supports something like that. Apart from that i have a question.

    May i use the same speed for All the peripherals SD, Ulcd, GPS? Or do i need to specify different one for each module?

    May i use 48mhz for processor speed and use low speed baudrate to communicate for Serial?

    Could You help me and clarity what i need for each GPS, SD, Ulcd?

    So i need to communicate Serial with GPS module and then i need to store the raw Nmea Data to SD and display what i need from the Nmea protocols to display.
    Last edited by astanapane; - 20th June 2018 at 15:49.

  31. #111
    Join Date
    Jan 2014
    Posts
    79

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

    Quote Originally Posted by astanapane View Post
    ooops i dint know.

    i tried many times to check if there is a newer version and didnt find any that 2.61 with the devicefile 1.61.
    The file "PK2Devicefile.dat" have not edited the microcontroller type. Use DEVICE EDITOR software from here https://sites.google.com/site/pk2devicefileeditor/ and here is the Device ID PIC's
    Attached Files Attached Files

  32. #112
    Join Date
    May 2013
    Location
    australia
    Posts
    1,425

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

    The project as i have it in mind need to have an SD in order to store the Data from GPS Nmea.

    I found out that only a microcontroller with 48mhz supports something like that
    where did you find that , its not what I understand the case to be. are you confusing usb support for sd card support ?

    May i use the same speed for All the peripherals SD, Ulcd, GPS? Or do i need to specify different one for each module?
    unless you specify what spi rate the sd card supports and what sd card system you intend to use [sdfs3 ? fat16? fat 32?] along with
    the baud rate used for the serial I/f's and your osc speed it would be guesswork only.


    Could You help me and clarity what i need for each GPS, SD, Ulcd?
    not really you need to supply a lot more info

    i need to communicate Serial with GPS module and then i need to store the raw Nmea Data to SD and display what i need from the Nmea protocols to display
    compared to PIC18F4550 or PIC18F2550 a pic 18f26k22 has two times the flash memory , sram ,spi ports, eusarts has more timers and can run at 64 MHz . I think it would be a good fit
    for that sort of project
    Last edited by richard; - 21st June 2018 at 01:49.
    This is more entertaining than Free to Air TV

  33. #113

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

    Quote Originally Posted by midali View Post
    The file "PK2Devicefile.dat" have not edited the microcontroller type. Use DEVICE EDITOR software from here https://sites.google.com/site/pk2devicefileeditor/ and here is the Device ID PIC's
    Really thanks a lot for your kind help. I would keep the dat. file as it is for now. I'm a bit afraid to play with that .dat file at the moment. If i need to use a PIC that is not on the pickit2 list, then i will give it a try.

  34. #114

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

    The project as i have it in mind need to have an SD in order to store the Data from GPS Nmea.
    I found out that only a microcontroller with 48mhz supports something like that

    where did you find that , its not what I understand the case to be. are you confusing usb support for sd card support ?
    Oops well i'm wrong, base on the following and FAT16 it is not necessary.

    http://melabs.com/samples/PBP-mixed/sdfs3.htm

    I was confused with this link as they specify high MCU speed for FAT32

    http://www.picbasic.co.uk/forum/showthread.php?t=18370

    May i use the same speed for All the peripherals SD, Ulcd, GPS? Or do i need to specify different one for each module?

    unless you specify what spi rate the sd card supports and what sd card system you intend to use [sdfs3 ? fat16? fat 32?] along with
    the baud rate used for the serial I/f's and your osc speed it would be guesswork only.
    Regarding Serial speed baudrate:

    1) For GPS, i have tried to send the "right" command for increase the baudrate, with no sucess....it seems that the GPS receives the command but does not like it :P.
    2) ulcd seems to work with higher baud rate, but i need to configure the delay times for each command. I havent really understand how to increase the baudrate corresponding to delays. The ulcd needs some delay time to accept the command and display it properly. Is it right?
    3) SD card with FAT 16 (when i reach that point we will discuss further). At the moment it is clear that up to 2GB fat 16 is required and is not necessary high MCU speed. But i will try to get the maximum from the PIC.

    Could You help me and clarity what i need for each GPS, SD, Ulcd?

    not really you need to supply a lot more info
    I understand that im not clear, as i really wont have the knowledge to explain it. Actually im confused with MCU speed, which is the speed that PIC running each command and calculate each command, with the speed of the communication ports.

    I guess that a higher MCU speed is better in order to calculate faster the information from the peripherals. I know my questions are too basic, and believe me i start reading all these stuff in order to understand better. I feel that you cannot help me i i dont understand these basic processes of the PIC.

    So i started to read about MCU speed, clock and counter.

    i need to communicate Serial with GPS module and then i need to store the raw Nmea Data to SD and display what i need from the Nmea protocols to display.

    compared to PIC18F4550 or PIC18F2550 a pic 18f26k22 has two times the flash memory , sram ,spi ports, eusarts has more timers and can run at 64 MHz . I think it would be a good fit
    for that sort of project

    Really appreciate your advice....PIC18LF26K22 or PIC18LF4550 fits to my project better because i would like to use a single 3.7V Lipo battery not more than 800-1000mha. The Final circuit will have:

    1. PIC18LF26K22 or PIC18LF4550
    2. GPS module for all the info....Date, Time, Speed, Coordinates etc.
    3. SD for storage the raw NMEA Data
    4. A display only for the on the go use. For battery saving, a ulcd will not be used normally. SD will keep the info.

    Many thanks once again.

    I would like to apologize for "breaking" the original TOPIC. Is it possible an Admin to move all the discussion i have started from POST #66, in a NEW thread? Thanks.....
    Last edited by astanapane; - 21st June 2018 at 07:45.

  35. #115
    Join Date
    May 2013
    Location
    australia
    Posts
    1,425

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

    1) For GPS, i have tried to send the "right" command for increase the baudrate, with no sucess....it seems that the GPS receives the command but does not like it :P.
    the data sheet for the module should resolve that issue

    2) ulcd seems to work with higher baud rate, but i need to configure the delay times for each command. I havent really understand how to increase the baudrate corresponding to delays. The ulcd needs some delay time to accept the command and display it properly. Is it right?
    the ulcd data sheet should give you that information

    3) SD card with FAT 16 (when i reach that point we will discuss further). At the moment it is clear that up to 2GB fat 16 is required and is not necessary high MCU speed. But i will try to get the maximum from the PIC.
    since sd cards use spi [a synchronous data transfer method] cpu osc speed is largely irrelevant as long as it not too fast for the card/mssp combination
    when you use the mssp module there are several spi clock options.


    a PIC18LF4550 is in my opinion not a good choice , the project calls for a chip with two eusarts.


    I would like to apologize for "breaking" the original TOPIC. Is it possible an Admin to move all the discussion i have started from POST #66, in a NEW thread? Thanks.....
    I agree, as I have said from the start what you are asking has no relevance to maidenhead in any way shape or form
    This is more entertaining than Free to Air TV

  36. #116

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

    Hi Richard,

    thanks once again for your time and help. You are right regarding the 18LF4550. It is not for my application.

  37. #117

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

    The leap years, month and days are fixed. Please let me know if you find any mistake on this.

    Is there any way now to test the leap year?

    Code:
    arraywrite ndays,13,NDAY,[0,31,28,31,30,31,30,31,31,30,31,30,31]
    
    if ((year//4 = 0) and (year//400 != 0)) then    'check the leap year
     ndays[2] = 29                                  'then February has 29 days
       else                                         
     ndays[2] = 28                                  'else has 28 days
     endif
     hh = hh + 3                                    'the Hour from GPS is UTC so for our country in Greece we add +3
     if hh>23 then                                  'if the hh+3 hour is greater than 23 (23:00) then
     day = day + 1                                  'we check the day added is true
     hh = hh//24                                    'but the hour not exceed the 24 so go to 00:00
        if (day > ndays[month]) then
     month = month + 1
     day = 1 
            if (month > 12) then
     year = year + 1
     month = 1
            endif
         endif
     endif
    
    
    NDAY:
    ndays[0] = 0
    ndays[1] = 31       'January
    ndays[2] = 28       'February
    ndays[3] = 31       'March
    ndays[4] = 30       'April
    ndays[5] = 31       'May
    ndays[6] = 30       'June
    ndays[7] = 31       'July
    ndays[8] = 31       'August
    ndays[9] = 30       'September
    ndays[10] = 31      'October
    ndays[11] = 30      'November
    ndays[12] = 31      'December
    Apart from that i have found the attached file for the PICKIT2. Do you have any reference on that?
    Attached Files Attached Files

  38. #118
    Join Date
    Feb 2013
    Location
    Quebec, Canada
    Posts
    64

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

    Quote Originally Posted by astanapane View Post
    1) For GPS, i have tried to send the "right" command for increase the baudrate, with no sucess....it seems that the GPS receives the command but does not like it :P.
    Some modules requires you to send a checksum at the end of the command. Here for a NEO-6M GPS Module:

    Code:
    'Turn off RMC - Recommended minimum specific GPS/Transit data
    hserout2 ["$PUBX,40,RMC,0,0,0,0,0,0*47", 13, 10]
    pause 500
    
    'Turn off GSA - GPS DOP and active satellites
    hserout2 ["$PUBX,40,GSA,0,0,0,0,0,0*4E", 13, 10]
    pause 500
    
    'Turn off GSV - GPS Satellites in view
    hserout2 ["$PUBX,40,GSV,0,0,0,0,0,0*59", 13, 10]
    pause 500
    
    'Turn off GLL - Geographic position, latitude / longitude
    hserout2 ["$PUBX,40,GLL,0,0,0,0,0,0*5C", 13, 10]
    pause 500
    
    'Turn on  ZDA
    hserout2 ["$PUBX,40,ZDA,0,1,0,0,0,0*45", 13, 10]
    pause 500
    Do you really need to change the baud rate? If you are just logging then 9600 is more than enough.

    FYI, here is my source for most of the NMEA sequences: http://aprs.gids.nl/nmea/

  39. #119

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

    Quote Originally Posted by MichelJasmin View Post
    Some modules requires you to send a checksum at the end of the command. Here for a NEO-6M GPS Module:

    Code:
    'Turn off RMC - Recommended minimum specific GPS/Transit data
    hserout2 ["$PUBX,40,RMC,0,0,0,0,0,0*47", 13, 10]
    pause 500
    
    'Turn off GSA - GPS DOP and active satellites
    hserout2 ["$PUBX,40,GSA,0,0,0,0,0,0*4E", 13, 10]
    pause 500
    
    'Turn off GSV - GPS Satellites in view
    hserout2 ["$PUBX,40,GSV,0,0,0,0,0,0*59", 13, 10]
    pause 500
    
    'Turn off GLL - Geographic position, latitude / longitude
    hserout2 ["$PUBX,40,GLL,0,0,0,0,0,0*5C", 13, 10]
    pause 500
    
    'Turn on  ZDA
    hserout2 ["$PUBX,40,ZDA,0,1,0,0,0,0*45", 13, 10]
    pause 500
    Do you really need to change the baud rate? If you are just logging then 9600 is more than enough.

    FYI, here is my source for most of the NMEA sequences: http://aprs.gids.nl/nmea/
    Yep, thanks a lot.....i've seen all that, for my case i have the MKT 3333 and 3339 module. Which have the following

    Code:
    'serout2 gps_rx,84, ["$PMTK314,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0*0D",13,10]      
    'serout2 gps_rx,84, ["$PMTK251,57600*2C",13,10]      ' baudrate, check MTK manual configuration
    'serout2 gps_rx,84, ["$PMTK220,200*2C",13,10]        ' 200(millisecond)=0.2(sec)-->1/0.2 pps=5 Hz
    The problem is that it does not work for some reason.

    I think i need to use the HSEROUT2 instead of SEROUT2. I'm confused at this point.

    I get online help for checksum from this site

    http://www.hhhh.org/wiml/proj/nmeaxor.html

  40. #120

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

    Ok i have right now:

    1. TX port which is connected to ulcd. Baudrate : 38400

    Example code:
    Code:
    pause 2000 
    serout2 LCD,6,[$55]      ' uOLED Initialize this is the 'U' character of autoband rate to LCD 
    pause 500         
    serout2 LCD,6,[$56,$01]  ' this is the Version info
    pause 500
    serout2 LCD,6,[$45]      ' clear the lcd
    pause 100

    2. RX port from GPS module. Baudrate : 9600

    Example code:
    Code:
    ;serin2  gps_tx,84,timeout,lostcable,[wait("$GNRMC"),_          ;we wait for $GNRMC
    The GPS at the moment is locked at 9600. Via the serial terminal GPS software i set it to 19200 and accepts the command. But only for the time the module is connected to the power. When we disconnect the power from GPS, the default commands are set.

    I dont mind for that right now as i found out that i can communicate with PIC at 19200 with GPS and receive the commands on the display.

    The setting for the Clock Speed is 8Mhz.

    Now if i increase the speed of the baudrate with GPS and goes up to 38400 then i cannot display anything.

    I did an experiment and added an external Crystal of 16 Mhz. For my surprise values presented on the display.

    I have a question now. something i dont like with the following code:

    Code:
    @ ERRORLEVEL -306 ; this command prevents the compiler to give you a notice of
                      ; crossing page boundary - make sure bits are set 
    #CONFIG
        __config _CONFIG1, _HS_OSC & _WDT_OFF & _LVP_OFF & _CP_OFF
    #ENDCONFIG
    
    Include "MODEDEFS.BAS"
    DEFINE OSC 8
    OSCCON=%01110000     '8 Mhz
    Why should i need to add both of the lines?

    Code:
    DEFINE OSC 8
    OSCCON=%01110000     '8 Mhz
    In case i remove any of these, it compiles ok, but program is not working.

    I need to specify that this is an internal OSC, but above in the configuration bits i have put _HS_OSC (if i remember that must be set from the manual)

    Is it right?

    thanks a lot for your help once again.

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

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