Testing percent prefix

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)
“Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. –Antoine de Saint-Exupery

Comments

  • 8 Comments sorted by Date Added Votes
  • GordonMcCombGordonMcComb Posts: 2,823
    edited March 2012 Vote Up0Vote Down
    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)
    
  • GordonMcCombGordonMcComb Posts: 2,823
    edited March 2012 Vote Up0Vote Down
    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) 
    
  • GordonMcCombGordonMcComb Posts: 2,823
    edited March 2012 Vote Up0Vote Down
    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) 
    
  • GordonMcCombGordonMcComb Posts: 2,823
    edited March 2012 Vote Up0Vote Down
    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
  • GordonMcCombGordonMcComb Posts: 2,823
    edited March 2012 Vote Up0Vote Down
    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)Phil Pilgrim (PhiPi) Posts: 20,117
    edited March 2012 Vote Up0Vote Down
    'Looks like it worked! I wonder what the fancy editor thinks when it sees %nn? Hex codes, maybe?

    -Phil
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. –Antoine de Saint-Exupery
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 20,117
    edited March 2012 Vote Up0Vote Down
    Testing percent prefix using the WYSIWYG editor: %40, A, B, C.
    [noparse]
    %40, A, B, C
    [/noparse]
    

    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
    “Perfection is achieved not when there is nothing more to add, but when there is nothing left to take away. –Antoine de Saint-Exupery
Sign In or Register to comment.