GPS NMEA time reader - Protocols

This is a discussion on GPS NMEA time reader - Protocols ; I have a commodity GPS (Garmin eTrex) This produces NMEA strings at 4800 baud that I can read easily with Kermit95. A string that starts with $GPRMC contains the date and time in GMT. The strings appear every few seconds, ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: GPS NMEA time reader

  1. GPS NMEA time reader

    I have a commodity GPS (Garmin eTrex)
    This produces NMEA strings at 4800 baud that I can read easily with
    Kermit95.

    A string that starts with $GPRMC contains the date and time in GMT.
    The strings appear every few seconds, with a granularity of +/-2 seconds.

    What I want to do is read these with Kermit95 and use them to set the time
    and date on a Windows PC. The fact that it is GMT is a little bit of a
    problem, and I thought someone else might already have done the work for
    me.

    If the script also worked on MSDOS and Unix, that would be great. On Unix,
    I think the GMT offset is not a big deal, but I don't know what to do on
    Windows/DOS.


    This is from 010904 September 1, 2004, at 13:40:58 GMT
    Once satellite lock is found, the position appears
    $GPRMC,134058,A,3850.1234,N,12230.5678,W,0.0,71.4, 010904,15.0,E,A*0D
    ------ ------
    Before satellite lock is found, there is no position, and no time.
    The ",V," indicates that the fix is no good.
    $GPRMC,,V,,,,,,,010904,15.0,E,N*00

    --
    ---
    Clarence A Dold - Hidden Valley (Lake County) CA USA 38.8-122.5


  2. Re: GPS NMEA time reader

    On 2004-09-01, dold@GPSXNMEAXt.usenet.us.com
    wrote:
    : I have a commodity GPS (Garmin eTrex)
    : This produces NMEA strings at 4800 baud that I can read easily with
    : Kermit95.
    :
    : A string that starts with $GPRMC contains the date and time in GMT.
    : The strings appear every few seconds, with a granularity of +/-2 seconds.
    :
    : What I want to do is read these with Kermit95 and use them to set the time
    : and date on a Windows PC. The fact that it is GMT is a little bit of a
    : problem, and I thought someone else might already have done the work for
    : me.
    :
    : If the script also worked on MSDOS and Unix, that would be great. On Unix,
    : I think the GMT offset is not a big deal, but I don't know what to do on
    : Windows/DOS.
    :
    C-Kermit and K95 include date/time functions that can handle GMT/localtime
    conversion:

    http://www.columbia.edu/kermit/ckermit80.html#x8.13

    MS-DOS Kermit, no. DOS itself (of course) has no knowledge of timezones.

    : This is from 010904 September 1, 2004, at 13:40:58 GMT
    : Once satellite lock is found, the position appears
    : $GPRMC,134058,A,3850.1234,N,12230.5678,W,0.0,71.4, 010904,15.0,E,A*0D
    : ------ ------
    : Before satellite lock is found, there is no position, and no time.
    : The ",V," indicates that the fix is no good.
    : $GPRMC,,V,,,,,,,010904,15.0,E,N*00
    :
    You didn't say how to decode these, but if a time is in there, Kermit
    string and date/time functions can deal with it. As to actually setting
    the system time, you'll need to invoke an external program (RUN or RUN START)
    with appropriate command line options and privileges.

    - Frank

  3. Re: GPS NMEA time reader

    Dr Eberhard W Lisse wrote:
    > I have and like the etrex too, but I use the netdate package to


    The thread is about someone who has no internet access, and wants to set
    the time using his GPS.
    I suppose the simplest thing is gpsutil, since it already exists.

  4. Re: GPS NMEA time reader

    dold@XReXXGPSXN.usenet.us.com wrote:
    > Dr Eberhard W Lisse wrote:
    >> I have and like the etrex too, but I use the netdate package to

    >
    > The thread is about someone who has no internet access, and wants to set
    > the time using his GPS.
    > I suppose the simplest thing is gpsutil, since it already exists.


    Just in case you haven't looked carefully I am from Namibia, and doubt that I
    have more/better access tha you in the US. But, even when I dialup here with my
    laptop I have configured ppp to fire ntp up on connect.

    el
    --
    replace nospam with the initials of my first and last name
    if you want to email me

  5. Re: GPS NMEA time reader

    Dr Eberhard W Lisse wrote:
    > Just in case you haven't looked carefully I am from Namibia, and doubt that I
    > have more/better access tha you in the US. But, even when I dialup here with my
    > laptop I have configured ppp to fire ntp up on connect.


    There was no internet access alllowed for the user that started the thread,
    but he did have a GPS.

    --
    ---
    Clarence A Dold - Hidden Valley (Lake County) CA USA 38.8-122.5


  6. Re: GPS NMEA time reader

    In article ,
    Frank da Cruz wrote:
    >On 2004-09-01, dold@GPSXNMEAXt.usenet.us.com
    >wrote:
    >: I have a commodity GPS (Garmin eTrex)
    >: This produces NMEA strings at 4800 baud that I can read easily with
    >: Kermit95.
    >:
    >: A string that starts with $GPRMC contains the date and time in GMT.
    >: The strings appear every few seconds, with a granularity of +/-2 seconds.
    >:
    >: What I want to do is read these with Kermit95 and use them to set the time
    >: and date on a Windows PC. The fact that it is GMT is a little bit of a
    >: problem, and I thought someone else might already have done the work for
    >: me.
    >:
    >: If the script also worked on MSDOS and Unix, that would be great. On Unix,
    >: I think the GMT offset is not a big deal, but I don't know what to do on
    >: Windows/DOS.
    >:
    >C-Kermit and K95 include date/time functions that can handle GMT/localtime
    >conversion:
    >
    > http://www.columbia.edu/kermit/ckermit80.html#x8.13
    >
    >MS-DOS Kermit, no. DOS itself (of course) has no knowledge of timezones.
    >
    >: This is from 010904 September 1, 2004, at 13:40:58 GMT
    >: Once satellite lock is found, the position appears
    >: $GPRMC,134058,A,3850.1234,N,12230.5678,W,0.0,71.4, 010904,15.0,E,A*0D
    >: ------ ------
    >: Before satellite lock is found, there is no position, and no time.
    >: The ",V," indicates that the fix is no good.
    >: $GPRMC,,V,,,,,,,010904,15.0,E,N*00
    >:
    >You didn't say how to decode these, but if a time is in there, Kermit
    >string and date/time functions can deal with it. As to actually setting
    >the system time, you'll need to invoke an external program (RUN or RUN START)
    >with appropriate command line options and privileges.



    The 'decoding' is obvious.
    The 2nd field is HHMMSS, the 11th field is DDMMYY
    (note: decoding derived from his supplied data, with the plain-text
    explanation line that precedes it, and his underlining of
    fields 2 and 11.)




  7. Re: GPS NMEA time reader

    On 2004-09-05, Robert Bonomi wrote:
    : In article ,
    : Frank da Cruz wrote:
    :>...
    :>: This is from 010904 September 1, 2004, at 13:40:58 GMT
    :>: Once satellite lock is found, the position appears
    :>: $GPRMC,134058,A,3850.1234,N,12230.5678,W,0.0,71.4, 010904,15.0,E,A*0D
    :>: ------ ------
    :>: Before satellite lock is found, there is no position, and no time.
    :>: The ",V," indicates that the fix is no good.
    :>: $GPRMC,,V,,,,,,,010904,15.0,E,N*00
    :>:
    :>You didn't say how to decode these, but if a time is in there, Kermit
    :>string and date/time functions can deal with it. As to actually setting
    :>the system time, you'll need to invoke an external program (RUN or RUN START)
    :>with appropriate command line options and privileges.
    :
    :
    : The 'decoding' is obvious.
    : The 2nd field is HHMMSS, the 11th field is DDMMYY
    : (note: decoding derived from his supplied data, with the plain-text
    : explanation line that precedes it, and his underlining of
    : fields 2 and 11.)
    :
    Hey, no making fun of me! OK, fine, here is a more helpful response.
    The record is a comma-seperated list. How to extract the date and time?

    .\%a = $GPRMC,134058,A,3850.1234,N,12230.5678,W,0.0,71.4, 010904,15.0,E,A*0D
    echo \fsplit(\%a,&a,{,},$.*)

    This splits the string items into the array \&a[], using comma as the item
    separator, and treating dollar sign, period, and asterisk as data characters.
    Here's the result:

    show array a
    \&a[]: Dimension = 13
    0. 13
    1. $GPRMC
    2. 134058
    3. A
    4. 3850.1234
    5. N
    6. 12230.5678
    7. W
    8. 0.0
    9. 71.4
    10. 010904
    11. 15.0
    12. E
    13. A*0D

    Now \&a[10] is the date and \&a[2] is the time. The date format used in
    the message is totally ambiguous (yes, *we* know it's ddmmyy but...) so we
    have to convert it to something parsable:

    .d := \&a[10] ; Date (notational convenience)
    .time := 20\s(d[5:2])\s(d[3:2])\s(d[1:2])_\&a[2]
    date \m(time)
    20040901 13:40:58

    But it's GMT not local time so we must convert; easy:

    date \m(time)GMT
    20040901 09:40:58

    Programmatically:

    .time := \fcvtdate(\m(time)GMT)
    echo \m(date)
    20040901 09:40:58

    Now to program this we have to allow for the degenerate form and we might
    also have to convert the result into some other format. Assuming we have
    read a satellite record into the variable \%a:

    void \fsplit(\%a,&a,{,},$.*)
    if ( def \&a[2] && def \&a[10] ) {
    .t := \&a[2]
    .time := \fcvtdate(20\s(d[5:2])\s(d[3:2])\s(d[1:2])_\&a[2]GMT)
    echo "Setting time to \m(time)..."
    run xxx \m(time) ; external command to set system time
    } else {
    end 1 "Date-time not not set"
    }

    The external time-setting command might require a different operand format.
    \vcvtdate() accepts an optional second argument to specify the format of
    the result:

    n1 = 1: yyyy-mmm-dd hh:mm:ss (mmm = English 3-letter month abbreviation)
    n1 = 2: dd-mmm-yyyy hh:mm:ss (ditto)
    n1 = 3: yyyymmddhhmmss (all numeric)

    Others can be done with string processing as illustrated above with the
    date. You might also need to discard the date portion of the date-time
    string and keep just the time:

    .time := \fword(\m(time),2,\32,

    - Frank

+ Reply to Thread