Code:
GPRMC VAR BYTE[64]
hh VAR BYTE 'hours
mm VAR BYTE 'minutes
ss VAR BYTE 'seconds
sss var word 'milliseconds
fix VAR WORD 'GPS fix
latdeg VAR BYTE 'degrees latitude
latmin VAR BYTE 'minutes latitude
latminn var word 'fractional minutes latitude
NS VAR BYTE 'north or south
londeg VAR BYTE 'degrees longitude
lonmin VAR BYTE 'minutes longitude
lonminn var word 'fractional minutes longitude
EW VAR BYTE 'east or west
Knots VAR byte 'speed in knots (units)
Knotss var byte 'speed in fractional knots
course var word 'heading
dy VAR BYTE 'day
mt VAR BYTE 'month
yr VAR BYTE 'year
'============= Main Program ==========================================
Main:
high gpwr
pause 3000
GPSin:
serin2 gps,188,3000,tmout,[WAIT("$GPRMC,"),STR GPRMC\63\"$"] 'Data IN from GPS
arrayread gprmc,[DEC2 hh,DEC2 mm,dec2 ss,_
wait(","),fix,wait(","),DEC2 latdeg,DEC2 latmin,wait("."),dec4 latminn,_
wait(","),NS,wait(","),DEC3 londeg,DEC2 lonmin,wait("."),dec4 lonminn,_
wait(","),EW,wait(","),dec knots,dec Knotss,dec course,_
wait(","),DEC2 dy,DEC2 mt,DEC2 yr] 'parse the GPS array into parts
if fix = "V" then gpsin 'jump to "waiting for fix" display
low gpwr
high xpwr
pause 1000
SEROUT2 xbtx,188,[$0D,$0A,"$GPRMC,",STR GPRMC\63] 'Data OUT to XBEE
pause 500
Hope this helps
Bookmarks