PDA

View Full Version : Testing percent prefix



Phil Pilgrim (PhiPi)
03-12-2012, 08:00 PM
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)

GordonMcComb
03-12-2012, 11:58 PM
Copy and pasted from Notepad:



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)

GordonMcComb
03-12-2012, 11:59 PM
Copy and pasted from WordPad (can support Unicode)



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)

GordonMcComb
03-13-2012, 12:00 AM
And now copied and pasted, then edited



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, 00, 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)

GordonMcComb
03-13-2012, 12:02 AM
Posts without editing: OK.
Posts with editing: Seems to drop characters, at least for me.

Using Firefox 10.0.2 under Windows XP SP3.

-- Gordon

GordonMcComb
03-13-2012, 02:34 AM
Per Phil's suggestion I'm now using the forum's plain text editor. After posting this I will edit it, to see if the percent prefix goes awry.



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)

Phil Pilgrim (PhiPi)
03-13-2012, 03:19 AM
'Looks like it worked! I wonder what the fancy editor thinks when it sees %nn? Hex codes, maybe?

-Phil

Phil Pilgrim (PhiPi)
03-13-2012, 07:06 PM
Testing percent prefix using the WYSIWYG editor: %40, A, B, C.



%40, A, B, C


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] tag, but to no avail. This is seriously screwed up and needs to be fixed.

-Phil