Shop OBEX P1 Docs P2 Docs Learn Events
bs2 gps lcd - Page 2 — Parallax Forums

bs2 gps lcd

2»

Comments

  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-10-23 16:16
    Still no good?

    The following is the same as above except
    '
    lcd start up
    SEROUT 0, n19200, [22, 12] 'initalize lcd -- restore, revised
    PAUSE 5 ' revised see page 8_of_11 for 12/$0C
    SEROUT 0, n19200, [LcdBLon] 'lcd bklt on RTS
    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    
    status  VAR Byte
    secs_10 VAR Byte
    secs_01 VAR Byte
    lat     VAR Byte (7)
    lon     VAR Byte (9)
    
    ' -----[ Constants ]------------------
    LcdBLon CON 17 ' backlight on
    
    'Baud rates (non-inverted):
    n4800 CON 188
    n19200 CON 32
    
    '--------------lcd start up-----------
    SEROUT 0, n19200, [22, 12] 'initalize lcd
    PAUSE 5
    SEROUT 0, n19200, [LcdBLon]          'lcd bklt on
    
    ' $GPRMC example
    ' $GPRMC,161229.487,A,3723.2475,N,12158.3416,W,0.13,309.62,120598, ,*10
    '            xx     x xxxxxxx     xxxxxxxxx
    
    Main:
    SERIN 15, n4800, [WAIT("RMC,"),SKIP 4,STR secs_10\1,STR secs_01\1,
    SKIP 5,STR status\1,SKIP 1,STR lat\7,SKIP 5,STR lon\9]
    
    ' print it
    SEROUT 0, n19200, [$0C]
    PAUSE 5
    SEROUT 0,n19200 [STR secs_10\1,STR secs_01\1," ",STR status\1,
    " ",STR lat\7,$0D,STR lon\9]
    
    ' $02 = home the cursor, non-destructive
    ' $0A = cursor to next line, same column
    ' $0D = carriage return
    ' $0C = Form Feed, Clear screen and Home cursor
    
    GOTO Main
    

    The Parallax display doesn't play well with the ASCII control characters and the way I'm used to seeing them effect ($00-$07 being custom characters, etc.)
  • brodbrod Posts: 16
    edited 2012-10-25 09:41
    PJ Just entered your new code, nothing, so decided to walk further and guess what it changed the results. You have to move about 60m for it to change, I would have thought it would have been more accurate than that.
    But still at least it works thanks for you help.
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-10-25 09:51
    brod,

    It's not a matter of inaccuracy. This is a "feature" of the PMB648, called "position fixing" that keeps it from racking up distance while you're stationary, due to normal GPS drift. You can turn that feature off if you want by entering a certain command in the unit's programming mode.

    -Phil
  • brodbrod Posts: 16
    edited 2012-10-25 09:53
    Thanks for that info Phil,
    I dont suppose you know what that code is?
    Brod
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-10-25 10:00
    I do, but I'll have to go out to the shop to dig it up. Uno momento, por favor.

    -Phil
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2012-10-25 10:08
    I have the commands in Spin, not PBASIC, so hopefully you can extract the necessary steps:
      gps.str(string("$PSRF100,0,4800,8,1,0*0F", CR, LF))   'Switch to SiRF binary protocol at 4800,8,N,1
       
      'Diable Static Navigation
      
      waitcnt(clkfreq + cnt)
      repeat i from 0 to 9
        gps.tx(DisStatNav[i])
       
      'Switch back To NMEA Protocol Message ID 129, leave only GGA and RMC strings and keep speed at 4800
      
      waitcnt(clkfreq / 2 + cnt)
      repeat i from 0 to 31
        gps.tx(BackToNMEA[i]) 
    

    Here's the SiRF data that gets sent from the above code:
    'SiRF Disable Static Navigation (position fixing), Message ID 143
    
    DisStatNav    byte      $A0,$A2,$00,$02,$8F,$00,$00,$8F,$B0,$B3
    
    'Switch back To NMEA Protocol Message ID 129 at 4800 bauds, leave on GGA and RMC strings updating oce per second.
    
    BackToNMEA    byte      $A0,$A2,$00,$18,$81,$02,$01,$01,$00,$01
                  byte      $00,$01,$00,$01,$01,$01,$00,$01,$00,$01
                  byte      $00,$01,$00,$01,$00,$01,$12,$C0,$01,$61
                  byte      $B0,$B3  
    

    Here's a link to the SiRF command reference (PDF):

    -Phil
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-10-25 10:12
    60 metres?
    What's that, 180 ft. or something?
    How far were you going before, a bit short of a "walk down the road" I guess.
    So, maybe the kickstart is OK on that basis, too?
  • brodbrod Posts: 16
    edited 2012-10-25 12:48
    Thanks for that Phil, I am new to coding but I will give it a go.
    PJ yes my attempt at coding works the same as well, as the data is updated every second and is accurate to about 5m I would have thought a 30m change in position (what I was doing before) would have updated the LCD.
    This little project has been a challenge but I feel I am getting somewhere now.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-10-25 16:08
    I like having the seconds and status available, as a heartbeat and a sanity check.
  • brodbrod Posts: 16
    edited 2012-10-26 00:26
    PJ yes I know what you mean.
    I dont suppose you know how to convert Phil's code into PBASIC do you? as I havent got a clue were to start.

    Brod
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-10-26 06:36
    I think it's a matter of SEROUTing those bytes to the GPS.

    SEROUT pin, 188, ["$PSRF100,0,4800,8,1,0*0F", CR, LF]

    SEROUT pin, 188, [$A0,$A2,$00,$02,$8F,$00,$00,$8F,$B0,$B3]

    SEROUT pin, 188, [$A0,$A2,$00,$18,$81,$02,$01,$01,$00,$01]

    SEROUT pin, 188, [$00,$01,$00,$01,$01,$01,$00,$01,$00,$01]

    SEROUT pin, 188, [$00,$01,$00,$01,$00,$01,$12,$C0,$01,$61]

    SEROUT pin, 188, [$B0,$B3]

    I think that can all be done via the SiRF demo, but the trouble with that is if you don't have your GPS on after a couple of days it gets dumped. I know that because I've configured mine with only RMC enabled and after going a couple of days or so unpowered it goes back to stock. So, the config codes need to be run as part of initialisation.

    I've uploaded it to the site a couple of times.
    Find that in the discussion at the following link (Reply #8) --
    http://forums.parallax.com/showthread.php?125402-Can-t-Read-GPS
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-10-26 09:31
    I set my '688 to output GLL and RMC once per second.
    From what I've read, $PSRF103,1,0,0,1*25<cr><lf> should terminate the GLL'ing, but I can't get that to happen.
    I know my serial is good because it works via the SiRF demo, but it's like the '688 isn't listening in NMEA ("normal") mode and I think it's supposed to.
  • brodbrod Posts: 16
    edited 2012-10-26 09:50
    PJ you are a star, I input your code and the position changes almost immediately you start walking.
    Well I am very happy now, thank you all for your help.
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-10-26 09:51
    Oh, Oh, Oh! ( :
    I had DTR/RTS enabled. Got rid of that and the Disable took!
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2012-10-26 09:55
    brod wrote: »
    PJ you are a star, I input your code and the position changes almost immediately you start walking.
    Well I am very happy now, thank you all for your help.

    Hey, alright, you're a satisfied customer.
    Never happens when the boss is watching. ( :
    Well, hey, Phil had the code, I just helped you to implement it.
    Please update us with your future success and all.
Sign In or Register to comment.