Advertisement
Atdiy

GPS Internal Antenna

Apr 6th, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.62 KB | None | 0 0
  1. OBJ
  2.  
  3. Debug : "FullDuplexSerialPlus"
  4. GPS : "GPS_Float_Lite"
  5. FS : "FloatString"
  6.  
  7. CON
  8.  
  9. _CLKMODE = XTAL1 + PLL16x
  10. _XINFREQ = 5_000_000
  11.  
  12. PUB Init | fv
  13.  
  14. 'Start FullDuplexSerialPlus terminal
  15. Debug.Start(31, 30, 0, 115200)
  16. Debug.Str(String("Reading GPS..."))
  17.  
  18. WaitCnt(ClkFreq * 2 + Cnt)
  19.  
  20. 'Start GPS object, GPS connected to P7
  21. GPS.Init
  22.  
  23. Repeat
  24. Debug.Str(String(16, 1))
  25.  
  26. FS.SetPrecision(7)
  27. fv := GPS.Float_Latitude_Deg ' Get latitude
  28. If fv <> floatNaN
  29. Debug.Str(FS.FloatToString(fv))
  30. Else
  31. Debug.Str(String("---"))
  32.  
  33. Debug.Str(String(","))
  34. fv := GPS.Float_Longitude_Deg ' Get longitude
  35. If fv <> floatNaN
  36. Debug.Str(FS.FloatToString(fv))
  37. Else
  38. Debug.Str(String("---"))
  39.  
  40. Debug.Str(String(","))
  41. fv := GPS.Float_Speed_Over_Ground ' Get speed
  42. If fv <> floatNaN
  43. Debug.Str(FS.FloatToString(fv))
  44. Else
  45. Debug.Str(String("---"))
  46.  
  47. Debug.Str(String(","))
  48. fv := GPS.Float_Altitude_Above_MSL ' Get altitude
  49. If fv <> floatNaN
  50. Debug.Str(FS.FloatToString(fv))
  51. Else
  52. Debug.Str(String("---"))
  53.  
  54. Debug.Str(String(","))
  55. fv := GPS.Float_Mag_Var_Deg ' Get magnetic variance
  56. If fv <> floatNaN
  57. Debug.Str(FS.FloatToString(fv))
  58. Else
  59. Debug.Str(String("---"))
  60.  
  61. Debug.Str(String(","))
  62. fv := GPS.Long_Month ' Get month
  63. If fv <> floatNaN
  64. Debug.Dec(GPS.Long_Month)
  65. Else
  66. Debug.Str(String("---"))
  67.  
  68. Debug.Str(String(","))
  69. fv := GPS.Long_Day ' Get day
  70. If fv <> floatNaN
  71. Debug.Dec(GPS.Long_Day)
  72. Else
  73. Debug.Str(String("---"))
  74.  
  75. Debug.Str(String(","))
  76. fv := GPS.Long_Year ' Get year
  77. If fv <> floatNaN
  78. Debug.Dec(GPS.Long_Year)
  79. Else
  80. Debug.Str(String("---"))
  81.  
  82. Debug.Str(String(","))
  83. fv := GPS.Long_Hour ' Get Hour
  84. If fv <> floatNaN
  85. Debug.Dec(GPS.Long_Hour)
  86. Else
  87. Debug.Str(String("---"))
  88.  
  89. Debug.Str(String(","))
  90. fv := GPS.Long_Minute ' Get Minute
  91. If fv <> floatNaN
  92. Debug.Dec(GPS.Long_Minute)
  93. Else
  94. Debug.Str(String("---"))
  95.  
  96. Debug.Str(String(","))
  97. fv := GPS.Long_Second ' Get Second
  98. If fv <> floatNaN
  99. Debug.Dec(GPS.Long_Second)
  100. Else
  101. Debug.Str(String("---"))
  102. WaitCnt(ClkFreq / 2 + ClkFreq / 4 + Cnt)
  103.  
  104. DAT
  105.  
  106. floatNaN LONG $7FFF_FFFF 'Means Not a Number
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement