Advertisement
Guest User

Untitled

a guest
Mar 12th, 2013
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.15 KB | None | 0 0
  1. CON
  2.  
  3. _clkmode = xtal1 + pll16x
  4. _xinfreq = 5_000_000
  5.  
  6. OBJ
  7.  
  8. pst : "Parallax Serial Terminal"
  9. GPS : "GPS_Float_Lite"
  10. FS : "FloatString"
  11. text : "vga_text"
  12.  
  13. Pub Main | Color, SentColor
  14.  
  15. pst.Start(115_200)
  16. GPS.Init
  17. text.start(8)
  18. text.out(00)
  19. dira[0..4]~ 'Pins 0-4 to input
  20.  
  21. waitcnt(clkfreq + cnt)
  22.  
  23. Color := 5
  24.  
  25. repeat
  26. if ina[0] == 0 'Down Black - Expectant
  27. Color := 0
  28. if ina[1] == 0 'Left Yellow - Delayed
  29. Color := 2
  30. if ina[2] == 0 'Center Send.
  31. SentColor := Color
  32. pst.Str(string("Color: "))
  33. pst.dec(SentColor)
  34. pst.char(32)
  35. Location
  36. pst.char(13)
  37. if ina[3] == 0 'Right Green - Minimal
  38. Color := 3
  39. if ina[4] == 0 'Up Red - Immediate
  40. Color := 1
  41.  
  42. PUB Location | fv
  43.  
  44. FS.SetPrecision(7)
  45. fv := GPS.Float_Latitude_Deg ' Get latitude
  46. If fv <> floatNaN
  47. pst.str(string("Latitude: "))
  48. pst.str(FS.FloatToString(fv))
  49. pst.char(32)
  50. Else
  51. pst.str(string("---"))
  52.  
  53. fv := GPS.Float_Longitude_Deg ' Get longitude
  54. If fv <> floatNaN
  55. pst.str(string("Longitude: "))
  56. pst.str(FS.FloatToString(fv))
  57. pst.char(32)
  58. Else
  59. pst.str(string("---"))
  60.  
  61. fv := GPS.Float_Altitude_Above_MSL ' Get altitude
  62. If fv <> floatNaN
  63. pst.str(string("Altitude: "))
  64. pst.str(FS.FloatToString(fv))
  65. pst.char(32)
  66. Else
  67. pst.str(string("---"))
  68.  
  69. fv := GPS.Long_Hour ' Get Hour
  70. If fv <> floatNaN
  71. pst.str(string("The time is: "))
  72. pst.dec(GPS.Long_Hour)
  73. Else
  74. pst.str(string("---"))
  75.  
  76. fv := GPS.Long_Minute ' Get Minute
  77. If fv <> floatNaN
  78. pst.dec(GPS.Long_Minute)
  79. Else
  80. pst.str(string("---"))
  81.  
  82. WaitCnt(ClkFreq / 2 + ClkFreq / 4 + Cnt)
  83.  
  84. DAT
  85.  
  86. floatNaN LONG $7FFF_FFFF 'Means Not a Number
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement