Connecting GPS Engine Board to PC Serial Port


Closed Thread
Results 1 to 3 of 3
  1. #1
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92

    Default Connecting GPS Engine Board to PC Serial Port

    Hi Friends,

    Hi friends,

    I have a GlobalSat ET-102 with serial output

    I´m connecting it to PIC microcontroller (please, see conde bellow) and I´m just receiving not valid GPGGA messages. (only GPGGA messages all the time)
    I´m not sure if my PIC software is ok or not. So, I Would like to connect the GPS board to my PC serial port in order to check the messages with GPSInfo.exe supplied by the GlobalSat
    I´m connecting the GPS gnd to serial port Gnd and the GPS´s TXA pin to RX´s serial port.
    Is that right and enough ?

    PIC => 16F877a @ 10 Mhz

    My Code :

    Define LCD_DREG PORTA
    Define LCD_DBIT 0
    Define LCD_RSREG PORTB
    Define LCD_RSBIT 4
    Define LCD_EREG PORTB
    Define LCD_EBIT 5

    define OSC 10

    Rem Variables

    hh var byte

    'Allocate Variables for GPS:
    tens VAR BYTE 'GPS results
    digits VAR BYTE
    tenth VAR BYTE
    knots VAR WORD
    fps VAR WORD
    fpm VAR WORD
    GPSin VAR PORTB.1


    ''''''''''''''''''''''''''''''''''''''''''''
    ' Variable Definitions
    ''''''''''''''''''''''''''''''''''''''''''''
    '
    timeH var byte(2)
    timeM var byte(2)
    timeS var byte(2)

    latD var byte(2)
    latM var byte(2)
    latS var byte(2)
    latH var byte

    lonD var byte(3)
    lonM var byte(2)
    lonS var byte(2)
    lonH var byte
    sats VAR BYTE(2)
    sats2 VAR BYTE(2)
    sats3 VAR BYTE(2)
    sats4 VAR BYTE(2)
    sats5 VAR BYTE(2)
    sats6 VAR BYTE(2)
    sats7 VAR BYTE(2)
    sats8 VAR BYTE(2)
    sats9 VAR BYTE(2)
    sats10 VAR BYTE(2)
    sats11 VAR BYTE(2)
    sats12 VAR BYTE(2)
    Dia var byte(2)
    Mes var byte(2)
    Ano var byte(2)


    spdI var byte
    spdD var byte(2)

    head var byte(3)

    mon var byte(2)
    day var byte(2)
    yr var byte(2)

    stat var byte
    G var byte
    D var byte
    M var byte
    A var byte
    F var byte
    GPGGA_IN var word


    TEMPWORD var word
    REPEAT var byte
    DEBOUNCE var byte
    CMDACK var byte


    teste = 1
    INTCON 0.7 = 1 ' START THE WHOLE THING RUNNING
    Pause 500

    inicio:
    lcdout $FE,1
    lcdout "inicializando-", dec teste
    Pause 30


    GPS:


    timeH = 0
    timeM = 0
    timeS = 0
    stat = 0
    sats = 0
    latD = 0
    latM = 0
    latS = 0
    latH = 0
    lonD = 0
    teste = 0

    Rem Reading some data in order to test

    SERIN2 GPSIN,188,2000,Nogps,[WAIT("$"),str sats\1, STR sats2\1, STR sats3\1, STR sats4\1,_
    str sats5\1, str sats6\1,str sats7\1, str sats8\1,_
    str sats9\1, str sats10\1, str sats11\1, str sats12\1,_
    skip 5, str dia\2, str mes\2, skip 26, str ano\2 ]



    lcdout $FE,1
    disp:

    lcdout $FE,1, sats, sats2,sats3,sats4, sats5, sats6, sats7, sats8, sats9, sats10,sats11, sats12, dia, mes, ano
    lcdout $FE, $C0, latD,"-",latm,"-",lats, "-",lath, "-",lond,
    Pause 10000

    GoTo GPS
    Nogps:
    LCDOut $FE, 1
    LCDOut "No GPS"
    Pause 2000
    teste = teste + 1
    LCDOut $FE, 1
    GoTo inicio

    Thanks

    Sérgio Pinheiro (Brazil)

  2. #2
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959

    Default

    Hi Sérgio,

    It's difficult to receive NMEA sentences by parsing them directly with SERIN2.
    Especially if you want to do anything with the data, such as print it out on an LCD.

    There is no time between sentences. The next sentence starts coming in immediately after the last one. So, when you take the time to display the results, you miss the beginning of the next one.

    The GPS receiver will start sending sentences as soon as it's powered up, so it's easy to miss the first one. From there you will only catch every other sentence.

    For example, with the following sequence, The first RMC will be missed do to start up time. So, the first sentence to be received will be the GGA. The next one (GSA) gets missed while displaying the GGA, so it sees GSV next. After that it catches the last GSV and skips the next one which will be another RMC. So, it never sees an RMC sentence, which is the one you want the most.


    $GPRMC,130717,V,5128.7968,N,00143.4973,E,084.3,112  .1,200106,,,N*61
    $GPGGA,130718,5118.7968,N,00043.4973,E,0,00,,00638 .1,M,050.8,M,,*53
    $GPGSA,A,1,,,,,,,,,,,,,,,*1E
    $GPGSV,3,1,09,02,32,307,00,04,66,250,48,07,04,220, 00,10,01,282,00*71
    $GPGSV,3,2,09,13,81,200,00,16,04,066,00,20,29,100, 45,23,60,065,52*71
    $GPGSV,3,3,09,24,45,169,37,,,,,,,,,,,,*4D

    You say that you only get GGA's. It's possible that your receiver only sends RMC and GGA since the others just give useless info about the satellites. So the example might not fit perfectly with your symptoms. Once you get it hooked up to the PC, you should be able to tell.

    With that said, if you want to recieve just the RMC, you can change the wait modifier to look for the whole sentence name.
    SERIN2 GPSIN,188,2000,Nogps,[WAIT("$GPRMC"),str sats\1 ....
    This will insure that it never gets skipped. If you also want to read the GGA you should have a second SERIN2 that looks for that one immediately after the RMC. Now you've got some time to calculate and display before the next RMC comes in.

    Also, keep in mind that some of the fields are variable length. You can't always rely on everything being in the same place all the time.

    The best way to parse NMEA data is to receive the entire sentence into a buffer using the USART and interrupts. Then, calculate the checksum by xoring all the bytes together, and compare it with the checksum in the sentence. If they aren't the same, dump the data. Then run through the buffer and "count commas" to seperate the fields. Using this method, you won't miss a thing, and there's plenty of time to do it, and run the rest of your program too.

    As for hooking it up to the PC, Yes, GPS TX to the PC RX, and vice versa. You'll also need a MAX 232 or equiv. If the receiver uses 5v levels.

    DT

  3. #3
    Join Date
    Nov 2003
    Location
    Sao Paulo - Brazil
    Posts
    92

    Smile

    Thank you very much, Darrel !

Similar Threads

  1. Send binary file to pic over pc serial port
    By xnihilo in forum mel PIC BASIC Pro
    Replies: 20
    Last Post: - 3rd May 2011, 14:47
  2. interfacing to the pc serial port
    By kelangfei in forum General
    Replies: 4
    Last Post: - 7th October 2007, 23:35
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 18:27
  4. PC serial port funny
    By nicjo in forum Serial
    Replies: 13
    Last Post: - 6th February 2007, 06:34
  5. PC Serial Port Connections
    By BigH in forum Serial
    Replies: 1
    Last Post: - 20th January 2006, 09:24

Members who have read this thread : 2

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