Two programming questions re: (1) GPS, and (2) time notation conversion
mmoreland
Posts: 89
(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?
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
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