Shop OBEX P1 Docs P2 Docs Learn Events
How to read the time and coordinates from GPS to PC — Parallax Forums

How to read the time and coordinates from GPS to PC

forumforum Posts: 2
edited 2008-04-28 15:24 in General Discussion
I was working on the GPS( parallax ) module. i tried to run the sxb program which i took it from the parallax website. however i am not sure of how to read the data from GPS to PC ?
also i am not sure of the following commmands....

Gps_rx VAR RB.2 ' RX from PGM-248
Gps_tx VAR RB.3 ' TX to PGM-248


as the GPS has inbuilt antenna module where from do i need to give the connections to RB.2 & RB.3 from the GPS module.


i tried using the hyperterminal to have look at the data however i could not see any sort of data being displayed on the hyperterminal window.

Thanks

Comments

  • John CoutureJohn Couture Posts: 370
    edited 2008-04-27 21:51
    I do not have one of these modules but your SX needs to periodically send a message to the PC via a serial command called SEROUT.

    In the SX help file there is an example called RFID Reader Interface. That program has a routine called "LCD_OUT" that sends data out a serial line that is initialized to 19200 baud and uses the SEROUT command. The kool thing about that subroutine is that you can send it a single byte, a string or a data label. So put something like this in your program:

    Main:
    ' send command to GPS

    ' receive GPS response and put into variables

    ' send time to PC
    PAUSE 1000
    goto main

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College

    Post Edited (John Couture) : 4/27/2008 10:36:43 PM GMT
  • John CoutureJohn Couture Posts: 370
    edited 2008-04-27 22:33
    As is always, the devil is in the details.· That RFID program also has a section called RX_RFID which reads a single character from the device.·

    To get anything from the GPS you have to ask it a question.· Thus:

    ' ask the GPS to send you the UTC time string
    ·· GPS_OUT "!GPS"· ' Hello GPS!
    ·· GPS_OUT $03···· ' send me·UTC time

    ' read result and store in various variables
    ·· SERIN RX_GPS,Baud,tmpHrs
    ·· SERIN RX_GPS,Baud,tmpMins
    ·· SERIN RX_GPS,Baud,tmpSecs

    ' display the results
    ·· TX_DEC2 tmpHrs
    ·· GPS_OUT ":"
    ·· TX_DEC2 tmpMins
    ·· GPS_OUT ":"··
    ·· TX_DEC2 tmpHrs
    ·· GPS_OUT ":"

    The SERIN command listens to the RX_GPS port and stores the data in the three variables.· To display those variables, which are in binary, you have to convert them into ASCII.··Several weeks ago Jon Williams posted a program that did that for the DS1307 chip on the PDB.· The thread is here:

    http://forums.parallax.com/showthread.php?p=555208

    Anyway in the 2008 version of the code (scroll down to the bottom of the thread) he had a subroutine called TX_DEC2 which took a value from a byte variable and converted it into an ASCII value.

    '

    ' Use: TX_DEC2 aByte
    ' -- sends aByte to serial output in DEC2 format

    SUB TX_DEC2
    · tmpB1 = __PARAM1····························· ' copy outgoing byte

    · IF tmpB1 < 100 THEN
    ··· tmpB2 = tmpB1 / 10
    ··· tmpB3 = __REMAINDER
    ··· tmpB2 = tmpB2 + "0"
    ··· TX_BYTE tmpB2
    ··· tmpB3 = tmpB3 + "0"
    ··· TX_BYTE tmpB3
    · ELSE
    ··· TX_STR "??"
    · ENDIF
    · ENDSUB



    Anyway, I hope that helps.· Again, I don't have·a GPS module, so most of this is a big guess (grin).


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    John J. Couture

    San Diego Miramar College
  • CCraigCCraig Posts: 163
    edited 2008-04-28 15:24
    The program you are running is the control program. It is for the SX processor (on the GPS board) that is talking to the actual GPS radio (sony).

    The pin assignments statements you posted are assigning pins 2 and 3 to receive and transmit on the pins. Note: you will have to connect to those pins on the onboard SX. That means solder connections. That will give you total control over the GPS. Joe Grand did a great job for leaving it open for us to mod. He even left open pads on the board. Jon Williams wrote a great article in N&V. I don't have it handy but look for it. IT IS mandatory reading. NOT optional.

    However, I don't think this is what you wish to do. IF you are trying to just see data, (again see Jon's N&V article), you can ground pin 4, and it will send the GPS strings out. Left unconnected, the GPS will be in the smart mode. I.E. you have to request the data you need/want. These pins are the normal (pre-installed) GPS pins (1-4).

    If I find the link for the article, I'll post it. It will walk you through it with a professional guide.

    HTH, Chris

    It's article 139 on this page.

    www.parallax.com/Resources/NutsVoltsColumns/NutsVoltsVolume7/tabid/450/Default.aspx

    Post Edited (CCraig) : 4/28/2008 3:33:26 PM GMT
Sign In or Register to comment.