Shop OBEX P1 Docs P2 Docs Learn Events
Two programming questions re: (1) GPS, and (2) time notation conversion — Parallax Forums

Two programming questions re: (1) GPS, and (2) time notation conversion

mmorelandmmoreland Posts: 89
edited 2011-10-20 03:34 in General Discussion
(1) I'm using a 28501 GPS module to obtain hour, day and month for a solar array controller, and everything is working fine...almost. Upon initial startup, while the GPS is warming up and beginning to receive from satellites, I get bad data. Once it's running, and for the remainder of the day, it is perfect. The initial lines of code are as follows:
Main:
SERIN GPSpin, T4800, 2000, No_GPS_Data, [WAIT ("GPRMC,"), SKIP 43, WAIT (","), SPSTR 4]
GOTO Get_Date
No_GPS_Data:
PAUSE 2500
GOTO Main
GET 0, d, dd
GET 2, m, mm
SERIN GPSpin, T4800, 2000, No_GPS_Data, [WAIT ("GPRMC,"), SPSTR 65]
GOTO Get_Hour
Get_Hour:
GET 0, h, hh

The label No_GPS_Data doesn't seem to be doing its job, or it is and I need something more in the code to get the process to slow down until the data is coming in correctly. Any suggestions?

(2) Using ((h-"0")*10)+(hh-"0"), I've obtained the hour in UTC and converted it to PST by subtracting 8 (((h-"0")*10)+(hh-"0")-8) which doesn't work in the early morning hours. Is there an easier way to derive PST from UTC, or is there something more I can do to the formula above to keep the numbers accurate and positive?

Comments

  • max72max72 Posts: 1,155
    edited 2011-10-20 00:20
    There is a "valid" char in the RMC string. A is valid, V is not yet fixed.
    A signifies the GPS is getting a fix, so you have position informations.
    Accurate date and time are available before that point (GPS strats form a "zero" point. When it gets a enough infos it sets the date and time. Then, later it fixes, giving coordinates and "A" as a valid indicator)
    If you can get a "valid" fix you are sure date and time are accurate.
    Massimo
  • sylvie369sylvie369 Posts: 1,622
    edited 2011-10-20 03:34
    Re. your first question, SERIN only shuffles things off to the Timeout label if there are no data. The GPS unit sends something almost immediately, well before the fix is attained. SERIN has no idea whether or not what it receives is valid.
Sign In or Register to comment.