PDA

View Full Version : gps bs2e



Tobias
03-20-2010, 10:09 PM
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

stamptrol
03-21-2010, 03:50 AM
Have you looked at the sample code in the product docs, located in the Store on the main Parallax page?

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
·

Tobias
03-22-2010, 09:11 PM
Do I use the tx wire or the rtx wire I have looked at the connection diagram and don't know? How can I hook it up to the bs2e with a serial connection or how would you do it? Thanks Toby

Tobias
03-26-2010, 12:43 PM
when i use the demo code that is provided for the (gpsdemov1.1.bs2) very first gps unit it debugs funny very funny numbers and it appears 700 to 1600 mph

I am looking for some demo code for the pmb688 gps unit where could i find it?

Thanks, Tobyhttp://forums.parallax.com/images/smilies/hop.gif

Franklin
03-26-2010, 11:38 PM
Could you attach the code you are downloading to the stamp to your next post? Try writing simple code that just outputs what the gps is sending you. Don't try any fancy conversions until after you are getting correct and stable data.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
- Stephen

Tobias
03-26-2010, 11:42 PM
It is the same demo code that they ofer for the very first gps unit 28146 it works good with that unit but not with the 28501

hover1
03-27-2010, 12:45 AM
The 28146 is a 'smart' GPS unit, meaning it is set up to wait for commands and then transmit requested data. The 28501 just sends out GPS data all the time and you have to capture it.

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


Tobias said...
It is the same demo code that they ofer for the very first gps unit 28146 it works good with that unit but not with the 28501

Tobias
03-29-2010, 11:25 AM
I dont have no idea what i am doing wrong I am trying to change the baud rate setting to 19200 con 32 is that correct I am sure having problems the lcd appear all kind of numbers and symbols and nothing seems to work right what am I not doing

Thanks, Toby

sylvie369
03-29-2010, 07:22 PM
First, are you able to display words and numbers properly on the LCD? Can you display your name, and the value of a counter variable? If not, tackle that first.

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[0] - 48)) + (10*(GPSSpeed[1] - 48)) + (GPSSpeed[2] - 48)

Where Speed is a word-sized variable holding the numeric version of your speed, and GPSSpeed[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[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.

Tobias
03-29-2010, 10:19 PM
is that also going to work for the pmb666 or 28501 unit from parallax? I haven't tried that but will later is there anywhere that i could find some demo code for a bs2e on speed etc. Thanks, Toby

sylvie369
03-30-2010, 12:43 AM
Tobias said...
is that also going to work for the pmb666 or 28501 unit from parallax? I haven't tried that but will later is there anywhere that i could find some demo code for a bs2e on speed etc. Thanks, Toby


Any unit that sends NMEA strings out as serial data can be parsed to grab out the data you want. You need to check to make sure that it sends out the data you're after, of course. If, for example, it were only to send out the $GPGGA string you wouldn't get the direct readout of speed over the ground that you get from the $GPRMC string (though you might be able to use the position data to calculate speed - I wouldn't want to myself). Take a look at the product description to see which strings your GPS sends out. It's good practice to get used to reading those product descriptions carefully - you'll learn all sorts of things that you need to know.

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.