OBJ
PST : "FullDuplexSerial"
GPS : "FullDuplexSerial"
CON
_clkmode = xtal1 + pll16x
_xinfreq = 5_000_000
GetLat = $05
GetLong = $06
PUB main
PST.start(31, 30, 0, 115200)
GPS.start(0, 0, %1100, 9600) ' GPS connected to pin0
repeat
GPS.str(string("!GPS")) ' GPS command header
GPS.tx(GetLat) ' for latitude
WriteVal
PST.str(string(","))
GPS.str(string("!GPS")) ' GPS command header
GPS.tx(GetLong) ' for longitude
WriteVal
PST.str(string(13))
WaitCnt(ClkFreq + Cnt) ' Wait 1 second
PRI WriteVal | Degrees, Minutes, MinutesD, Dir, workVal
WaitCnt(ClkFreq / 10 + Cnt) ' 1/10 second wait
Degrees := GPS.rx ' Retrieve bytes from GPS
Minutes := GPS.rx
MinutesD := (GPS.rx << 8) | GPS.rx
Dir := GPS.rx==1
if dir == -1 ' If Dir = -1, prepend - sign
PST.str(string("-"))
PST.dec(Degrees)
PST.str(string("."))
workVal := (Minutes * 1000 / 6) + (MinutesD / 60)
PST.dec(workVal)
Comments
Posts with editing: Seems to drop characters, at least for me.
Using Firefox 10.0.2 under Windows XP SP3.
-- Gordon
-Phil
I entered the hex codes for "@", "A", "B", and "C". It interpreted all but the %40. In the code section, I even included a [noparse][noparse][/noparse] tag, but to no avail. This is seriously screwed up and needs to be fixed.
-Phil