Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OBJ
- Debug : "FullDuplexSerialPlus"
- GPS : "GPS_Float_Lite"
- FS : "FloatString"
- CON
- _CLKMODE = XTAL1 + PLL16x
- _XINFREQ = 5_000_000
- PUB Init | fv
- 'Start FullDuplexSerialPlus terminal
- Debug.Start(31, 30, 0, 115200)
- Debug.Str(String("Reading GPS..."))
- WaitCnt(ClkFreq * 2 + Cnt)
- 'Start GPS object, GPS connected to P7
- GPS.Init
- Repeat
- Debug.Str(String(16, 1))
- FS.SetPrecision(7)
- fv := GPS.Float_Latitude_Deg ' Get latitude
- If fv <> floatNaN
- Debug.Str(FS.FloatToString(fv))
- Else
- Debug.Str(String("---"))
- Debug.Str(String(","))
- fv := GPS.Float_Longitude_Deg ' Get longitude
- If fv <> floatNaN
- Debug.Str(FS.FloatToString(fv))
- Else
- Debug.Str(String("---"))
- Debug.Str(String(","))
- fv := GPS.Float_Speed_Over_Ground ' Get speed
- If fv <> floatNaN
- Debug.Str(FS.FloatToString(fv))
- Else
- Debug.Str(String("---"))
- Debug.Str(String(","))
- fv := GPS.Float_Altitude_Above_MSL ' Get altitude
- If fv <> floatNaN
- Debug.Str(FS.FloatToString(fv))
- Else
- Debug.Str(String("---"))
- Debug.Str(String(","))
- fv := GPS.Float_Mag_Var_Deg ' Get magnetic variance
- If fv <> floatNaN
- Debug.Str(FS.FloatToString(fv))
- Else
- Debug.Str(String("---"))
- Debug.Str(String(","))
- fv := GPS.Long_Month ' Get month
- If fv <> floatNaN
- Debug.Dec(GPS.Long_Month)
- Else
- Debug.Str(String("---"))
- Debug.Str(String(","))
- fv := GPS.Long_Day ' Get day
- If fv <> floatNaN
- Debug.Dec(GPS.Long_Day)
- Else
- Debug.Str(String("---"))
- Debug.Str(String(","))
- fv := GPS.Long_Year ' Get year
- If fv <> floatNaN
- Debug.Dec(GPS.Long_Year)
- Else
- Debug.Str(String("---"))
- Debug.Str(String(","))
- fv := GPS.Long_Hour ' Get Hour
- If fv <> floatNaN
- Debug.Dec(GPS.Long_Hour)
- Else
- Debug.Str(String("---"))
- Debug.Str(String(","))
- fv := GPS.Long_Minute ' Get Minute
- If fv <> floatNaN
- Debug.Dec(GPS.Long_Minute)
- Else
- Debug.Str(String("---"))
- Debug.Str(String(","))
- fv := GPS.Long_Second ' Get Second
- If fv <> floatNaN
- Debug.Dec(GPS.Long_Second)
- Else
- Debug.Str(String("---"))
- WaitCnt(ClkFreq / 2 + ClkFreq / 4 + Cnt)
- DAT
- floatNaN LONG $7FFF_FFFF 'Means Not a Number
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement