BS2 GPS Interface
Archiver
Posts: 46,084
I've written a couple articles for Nuts & Volts on GPS interfacing but
have previously only used the BS2p so that I could buffer the GPS data
into the Scratchpad. Having been contacted by a reader regarding using
a BS2 with Garmin text mode, I decided to play a bit. Good news.
The guys at Garmin did a nice thing by allowing fixed-field text output
-- even nicer that you can set the baud rate for that output from 1200
to 9600 baud. Experimenting with the BS2, I found that I could use
SERIN modifiers (SKIP and DEC) to capture all the interesting GPS data
if I set the baud rate to 2400. Here's the very busy SERIN:
SERIN Rx, Baud, TimeOut, No_GPS,
[noparse][[/noparse]WAIT("@"), SKIP 6, DEC2 hr, DEC2 mn, DEC2 sc,
latHemi, DEC2 latD, DEC2 latM, DEC2 latF, SKIP 1,
lonHemi, DEC3 lonD, DEC2 lonM, DEC2 lonF, SKIP 1,
SKIP 4, altSign, DEC5 alt,
ewDir, DEC4 ewVel, nsDir, DEC4 nsVel]
Again, you must use a Garmin eTrex (family) GPS receiver and have it set
to text output at 2400 baud (you can do 9600 baud if you're using a
BS2sx or BS2p). SERIN takes care of most of the hard work and there is
still over 700 milliseconds of processing time left before the next GPS
string shows up.
I uploaded a little demo program that displays the time after capturing
everything -- the time display proves that I'm not missing any GPS
output (and yes, I tested the various data to make sure everything was
captured correctly. One thing you may notice is that I'm only capturing
the first two digits of the fractional minutes values, hence the SKIP 1
as the values are presented as three digits in the stream.
I hope this helps BS2 users who have wanted to experiment with GPS.
-- Jon Williams
-- Parallax
have previously only used the BS2p so that I could buffer the GPS data
into the Scratchpad. Having been contacted by a reader regarding using
a BS2 with Garmin text mode, I decided to play a bit. Good news.
The guys at Garmin did a nice thing by allowing fixed-field text output
-- even nicer that you can set the baud rate for that output from 1200
to 9600 baud. Experimenting with the BS2, I found that I could use
SERIN modifiers (SKIP and DEC) to capture all the interesting GPS data
if I set the baud rate to 2400. Here's the very busy SERIN:
SERIN Rx, Baud, TimeOut, No_GPS,
[noparse][[/noparse]WAIT("@"), SKIP 6, DEC2 hr, DEC2 mn, DEC2 sc,
latHemi, DEC2 latD, DEC2 latM, DEC2 latF, SKIP 1,
lonHemi, DEC3 lonD, DEC2 lonM, DEC2 lonF, SKIP 1,
SKIP 4, altSign, DEC5 alt,
ewDir, DEC4 ewVel, nsDir, DEC4 nsVel]
Again, you must use a Garmin eTrex (family) GPS receiver and have it set
to text output at 2400 baud (you can do 9600 baud if you're using a
BS2sx or BS2p). SERIN takes care of most of the hard work and there is
still over 700 milliseconds of processing time left before the next GPS
string shows up.
I uploaded a little demo program that displays the time after capturing
everything -- the time display proves that I'm not missing any GPS
output (and yes, I tested the various data to make sure everything was
captured correctly. One thing you may notice is that I'm only capturing
the first two digits of the fractional minutes values, hence the SKIP 1
as the values are presented as three digits in the stream.
I hope this helps BS2 users who have wanted to experiment with GPS.
-- Jon Williams
-- Parallax