Shop OBEX P1 Docs P2 Docs Learn Events
GPS Help — Parallax Forums

GPS Help

HubertHubert Posts: 22
edited 2005-11-02 22:58 in BASIC Stamp
I am trying to transfer a serial stream of binary ASCII data from my GPS receiver to a basic stamp at 4800 baud.· I originally had the BS2 and found that every other character was being lost in transmission.· I upgraded to the 2px of its hardware input buffer.· However,·I am having trouble finding the corrct baudmode.··The baudmode corresponding to 4800 baud does not seem to be working. All I get when I debug is a bunch of non-acsii characters.

Can anyone help?

Hubert

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-10-30 21:09
    The easiest way to prevent baudmode errors is to use conditional compilation.· Here's what I have at the top of every one of my programs that uses serial I/O -- you see that 4800 baud is included.·

    #SELECT $STAMP
    · #CASE BS2, BS2E, BS2PE
    ··· T1200······ CON···· 813
    ··· T2400······ CON···· 396
    ··· T4800······ CON···· 188
    ··· T9600······ CON···· 84
    ··· T19K2······ CON···· 32
    ··· TMidi······ CON···· 12
    ··· T38K4······ CON···· 6
    · #CASE BS2SX, BS2P
    ··· T1200······ CON···· 2063
    ··· T2400······ CON···· 1021
    ··· T4800······ CON···· 500
    ··· T9600······ CON···· 240
    ··· T19K2······ CON···· 110
    ··· TMidi······ CON···· 60
    ··· T38K4······ CON···· 45
    · #CASE BS2PX
    ··· T1200······ CON···· 3313
    ··· T2400······ CON···· 1646
    ··· T4800······ CON···· 813
    ··· T9600······ CON···· 396
    ··· T19K2······ CON···· 188
    ··· TMidi······ CON···· 108
    ··· T38K4······ CON···· 84
    #ENDSELECT
    SevenBit······· CON···· $2000
    Inverted······· CON···· $4000
    Open··········· CON···· $8000
    Baud··········· CON···· T9600

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • HubertHubert Posts: 22
    edited 2005-10-30 23:45
    Im getting some errors from the compiler saying that the #'s in the code are unrecognized characters and that a Hex digit is expected following the $.· Does the code have to be altered in some way?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2005-10-30 23:53
    Sounds like you don't have the PBASIC 2.5 directive in your code.· Please select that from the Directive Menu, or click the icon on the toolbar that says 2.5.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
    csavage@parallax.com
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2005-10-31 20:53
    H,

    Maybe some of my programming from a similar [noparse][[/noparse]?]·project may be of use?

    http://forums.parallax.com/showthread.php?p=550377
  • HubertHubert Posts: 22
    edited 2005-11-01 00:49
    ·PJ,

    That does help. A lot!

    Thanks,
    Hubert
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2005-11-01 02:05
    Excellent.· Post back your results, &c.

    -- PJ --
  • HubertHubert Posts: 22
    edited 2005-11-02 19:44
    The GPS message that I am using is a GGA message. My code looks ver similar to yours, parsing data and skipping what I do not want. However, I am attempting to view the data in the debug screen. All I get when I try to debug is "OOE" and the program does not even loop back. Here I the code I am using:

    ' {$STAMP BS2}

    BtnWrk VAR Byte
    DEG_N VAR Byte(4)
    MIN_N VAR Byte(4)
    N VAR Byte(1)
    DEG_W VAR Byte(5)
    MIN_W VAR Byte(4)
    W VAR Byte(1)
    UTC VAR Byte(6)

    Get_DATA:

    SERIN 15,188,[noparse][[/noparse]WAIT("GGA,"),SKIP 11,STR DEG_N\4, SKIP 1, STR MIN_N\4, SKIP 1, STR W\1,
    SKIP 1, STR DEG_W\(5), SKIP 1, STR MIN_W\4, SKIP 1, STR W\1]

    DEBUG DEG_N, MIN_N, N, DEG_W, MIN_W, W

    GOTO Get_DATA

    END



    What am I doing wrong?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-02 20:22
    Since you're receiving data a strings you need to display it that way too -- use the STR modifier with DEBUG.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • HubertHubert Posts: 22
    edited 2005-11-02 22:36
    Jon,

    I changed the code to include the STR modifier but now all I get is a blank DEBUG screen. Here is the code:

    ' {$STAMP BS2}


    BtnWrk VAR Byte
    DEG_N VAR Byte(4)
    MIN_N VAR Byte(4)
    N VAR Byte(1)
    DEG_W VAR Byte(5)
    MIN_W VAR Byte(4)
    W VAR Byte(1)
    UTC VAR Byte(6)

    Get_DATA:

    SERIN 15,188,[noparse][[/noparse]WAIT("GLL,"),STR DEG_N\4, SKIP 1, STR MIN_N\4, SKIP 1, STR W\1,
    SKIP 1, STR DEG_W\5, SKIP 1, STR MIN_W\4, SKIP 1, STR W\1]

    DEBUG STR DEG_N, STR MIN_N, STR N, STR DEG_W, STR MIN_W, STR W

    GOTO Get_DATA
    END
  • HubertHubert Posts: 22
    edited 2005-11-02 22:43
    Oh, I see nevermind.... I was using the wrong header so the program was waiting for something that it was never going to see...
  • HubertHubert Posts: 22
    edited 2005-11-02 22:47
    How do I insert a CR/LF in between readings?
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-11-02 22:54
    DEBUG CR

    Though the Stamp DEBUG window adds a linefeed to CR, so you just need to insert that between readings.· The online help file (hint, hint) has a lot of details on DEBUG.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • HubertHubert Posts: 22
    edited 2005-11-02 22:58
    Got it!....
Sign In or Register to comment.