Shop OBEX P1 Docs P2 Docs Learn Events
Using SPSTR for GPS GPRMC — Parallax Forums

Using SPSTR for GPS GPRMC

cutsrockcutsrock Posts: 32
edited 2008-03-08 01:15 in BASIC Stamp
I am trying to use Nuts & Volts article #83 code with a BS2px, but having dificulty getting the SPSTR instruction to save the GPRMC to Scratch Pad Ram.· I have conditionally compiled the code and I am using the following line to capture the GPRMC string.

SERIN GPSpin, T4800, 3000, No_GPS_Data, [noparse][[/noparse]WAIT("GPRMC,"), SPSTR 65]

The conditional compiling:

'
[noparse][[/noparse] I/O Definitions ]
'
GPSpin········· CON···· 15······················ ' GPS serial input

'
[noparse][[/noparse] Constants ]
'
#SELECT $STAMP
· #CASE BS2, BS2E, BS2PE
··· T1200······ CON···· 813···················· 'INT(1,000,000/Baud)-20
··· T2400······ CON···· 396···················· 'INT(1,000,000/Baud)-20
··· T4800······ CON···· 188···················· 'INT(1,000,000/Baud)-20
··· T9600······ CON···· 84····················· 'INT(1,000,000/Baud)-20
··· T19K2······ CON···· 32····················· 'INT(1,000,000/Baud)-20
··· T38K4······ CON···· 6······················ 'INT(1,000,000/Baud)-20
· #CASE BS2SX, BS2P
··· T1200······ CON···· 2063··················· 'INT(2,500,000/Baud)-20
··· T2400······ CON···· 1021··················· 'INT(2,500,000/Baud)-20
··· T4800······ CON···· 500···················· 'INT(2,500,000/Baud)-20
··· T9600······ CON···· 240···················· 'INT(2,500,000/Baud)-20
··· T19K2······ CON···· 110···················· 'INT(2,500,000/Baud)-20
··· T38K4······ CON···· 45····················· 'INT(2,500,000/Baud)-20
· #CASE BS2PX
··· T2400······ CON···· 1646··················· 'INT(4,000,000/Baud)-20
··· T4800······ CON···· 813···················· 'INT(4,000,000/Baud)-20
··· T9600······ CON···· 396···················· 'INT(4,000,000/Baud)-20
··· T19K2······ CON···· 188···················· 'INT(4,000,000/Baud)-20
··· T38K4······ CON···· 84····················· 'INT(4,000,000/Baud)-20
#ENDSELECT

When I try to Print the string or any variable after parsing I get nothing.

I am sure it is somthing simple I am missing.

The GPS unit is a Garmin 16 HVS and I can config it's baud rate up to T38K4 and to output one or more·NEMA sentences.

I have attached the NV83 code as I revised it to work with the BS2px.

Any suggestions.



▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
EPIC FAILURE -·When everyday run-of-the-mill failure just isn't good enough.

Comments

  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2008-03-07 22:46
    Hello,

    It’s not clear from your post where you’re having a problem. The GPS String is in the scratchpad and not a variable. So the question is how are you getting the scratchpad data into the variables? The Nuts & Volts article had a subroutine that did that work for you.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • cutsrockcutsrock Posts: 32
    edited 2008-03-07 23:54
    I am using the subroutine that was in the Nuts & Volts article. In fact I only changed the code, from the article, to use with the BS2px. The statement - SERIN GPSpin, T4800, 3000, No_GPS_Data, [noparse][[/noparse]WAIT("GPRMC,"), SPSTR 65] - seems not to work. The code does not seem to parse the sting and never reaches the - Show_GPMRC_String: -. Which I think should work without parsing the string, since it is an ASCII string. It just seems to be waiting for the Data.

    My GPS is sending data because the code does not goto -NO_GPS_DATA- unless I disable the GPSpin or turn off the GPS. The GPS is configurable to different baud rates and can be done with a config program provided by Garmin or through it's input pin.· At this time the GPS Baud rate is 4800.

    I have connected the GPS output pin (Data Out) to different pins in the BS2px. Pins 1, 2, 14, 15 have been used. After re-reading the Data sheets and Pbasic help it would seem that to be safe a 22K ohm resistor should be place on the input pin. I am about to try that.

    I have a second BS2px that I can try if need be.

    Thanks

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    EPIC FAILURE -·When everyday run-of-the-mill failure just isn't good enough.

    Post Edited (cutsrock) : 3/8/2008 12:01:00 AM GMT
  • Phil Pilgrim (PhiPi)Phil Pilgrim (PhiPi) Posts: 23,514
    edited 2008-03-08 00:04
    If you're using the Port 1 output from this device, its specs indicate that it's a "true" RS232 output, which means: 1) that the voltage can swing up to +/-12V, and 2) that the logic is inverted. You are right that a rather large input resistor will be necessary to keep from damaging the BASIC Stamp. You will also need to configure the baud mode for inverted, rather than true, input.

    -Phil

    Post Edited (Phil Pilgrim (PhiPi)) : 3/8/2008 12:09:19 AM GMT
  • cutsrockcutsrock Posts: 32
    edited 2008-03-08 01:15
    Thank you PhiPi and Chris for pointing me in the correct direction. I thought that it had something to do with the Baud rate and,or definition. I simply added the following to Jon's Code,

    Inverted CON $4000
    Baud CON T4800 + Inverted ' baud rate for GPS

    Then changed the SERIN command to,
    SERIN GPSpin, Baud, 3000, No_GPS_Data, [noparse][[/noparse]WAIT("GPRMC,"), SPSTR 65]
    and got the expected results.

    Now to incorporate a LCD and apply the BS2px to a super carrier board or get a PCB made for the components needed to finish my project.

    Thanks again.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    EPIC FAILURE -·When everyday run-of-the-mill failure just isn't good enough.
Sign In or Register to comment.