gps bs2e
Tobias
Posts: 95
Could anyone please lead me to help? I would like to have some code for a speed and time data·with the 28501 gps unit. thanks Toby
Comments
The basic communication process is the same for all gps serial units. Have a look at the docs for the 28146.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Tom Sisk
http://www.siskconsult.com
·
I am looking for some demo code for the pmb688 gps unit where could i find it?
Thanks, Toby
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen
Here is some good reading : http://forums.parallax.com/attachment.php?attachmentid=67605
You will have to modify the baud rate setting for a BS2e to get 4800.
Jim
Thanks, Toby
If you're okay on the LCD side, then your issue is in capturing the parts of the GPS output strings that you want to use. The GPS simply sends out strings of characters:
http://www.gpsinformation.org/dale/nmea.htm#GGA
You need to read those strings in using a SERIN command, WAITing for the $GPGGA (or whichever string you're going to use), then SKIPing to the position in the string that contains the data you need. You will probably need to convert the string of characters to whatever format you're going to use.·For example, the $GPRMC string gives you speed in knots, but it's not a single variable holding that speed as a number. It's a set of characters (that is, again, a string), such as "022.4". You'd need to read in the first character, convert it to a number, multiply that number by 100, then read in the second character, convert it to a number, multiply that number by 10 and add it to the first number, read in the third character, convert it to a number, add that to the first two, and then if you're willing to tackle fractions, do the same with the tenths position (that's going to be more difficult, of course, as Stamps use integer math).
So for "022.4", if you were just doing the integer part, you'd read the first three characters into a three-character byte array. "0" = ASCII 48, and "2" = ASCII 50. If you have a digit character from 0-9, you subtract 48 from the·Ascii code for that character to get the corresponding number. So you'd do
Speed = (100*(GPSSpeed[noparse][[/noparse]0] - 48)) + (10*(GPSSpeed[noparse][[/noparse]1] - 48)) + (GPSSpeed[noparse][[/noparse]2] - 48)
Where Speed is a word-sized variable holding the numeric version of your speed, and GPSSpeed[noparse][[/noparse]3] is a byte array into which you've read the first three characters of the "speed over the ground" part of the $GPRMC string. If you wanted the fractional part as well, the easiest way would be to just multiply everything by ten (so you'd have "1000*(GPSSpeed[noparse][[/noparse]0]"), etc.), and deal with it later in display or in whatever you're dumping the data into.
The BS2pe can handle all of this just fine.
I doubt that you're going to just stumble across demo code that gives you the speed readout. You're going to have to learn to parse the strings and pull out the data yourself. If you're going to work with GPS and microprocessors, that's something you need to figure out. It will be very educational for you to work through that, and you will understand how to get out whatever data you need.