PDA

View Full Version : Serial Data from GPS Chip -- Help



Hubert
08-20-2005, 04:26 PM
I am trying to read in serial data from a GPS chip a to the BS2 using the serin command at 9600 baud.· It seems that the stamp is missing every third character. I need to know if there is a way that I can solve this problem.

Post Edited By Moderator (Jon Williams (Parallax)) : 8/20/2005 2:02:45 PM GMT

steve_b
08-20-2005, 04:56 PM
Have you tried to slow down the baud rate of the GPS....the handheld units would have the option to drop down to 2400baud.

Is it consistantly dropping the third character?
Verify with a PC and hyperterm that the 3character is present consistantly.
Make sure your grounds are properly connected.
How are you serin'ing data? Is the thirst character something you actually need?

**Also, come up with a better subject heading on your message; something more representative of your problem.· Many people skip over posts that don't interest them....and certainly "no subject" isn't very interesting!! ;)

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·

Steve

"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

Bruce Bates
08-20-2005, 05:23 PM
Hubert -

If you're using the SKIP sub-parameter in your SERIN commnad, mke sure you're skipping in the right places. Check the Hyperterminal output suggested above to what is in your SERIN command both for SKIP appropriateness, if you're using it, and the character length of fields. Check also that formatters such as DEC3 shouldn't be DEC2 or similar discrepancies between the formatting modifiers and the actual data.

Regards,

Bruce Bates

Forrest
08-20-2005, 07:56 PM
See this post and attached program http://forums.parallax.com/showthread.php?p=545791

Hubert
08-21-2005, 07:34 AM
·I am using a hyper terminal to read the output of the GPS chip and comparing·that with what·I get when debugging the stamp.· It appears to be skipping every third character.· I do need these characters.· I am currently looking into the GPS protocol to try and slow down the baud rate.· There is something in the stamp manual about difficullty synchronizing at this data rate but I·think my best bet is to slow down the output of the GPS chip.· I'll let you know what happens.· Thanks for your help Steve!!

steve_b
08-21-2005, 09:48 AM
No problem.....it's a community here!
If you read a post that you can add some advice to, then please do so!! "pay it forward" if you like! :)

Is the third character 'ever' there? I think you're previous message says you used Hyperterm and the character was still missing....not sure!
Care to post the code you are using?!
9600 really isn't all that fast for the stamp.....but certainly slowly things down gives you better readability so far as data goes!

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·

Steve

"Inside each and every one of us is our one, true authentic swing. Something we was born with. Something that's ours and ours alone. Something that can't be learned... something that's got to be remembered."

Hubert
08-24-2005, 11:02 AM
Here is a sample of the code that I am using:

' {$STAMP BS2}
start
SerData VAR Byte(10)

SERIN 15,16572,[SerData]

DEBUG STR SerData
GOTO start


It is fairly simple but I have tried several variations of this code. Other SERIN fromatter just output garbage( Non ASCII characters).
I attempted to adjust the array size and I have even tried writing the message to memory and then DEBUGing but nothing seems to work.
Hopefully I can slow things down a bit but I still need to process the information rather quickly.

Bruce Bates
08-24-2005, 12:44 PM
Hubert

Perhaps this is what you internded to do:

Here is a sample of the code that I am using:

' {$STAMP BS2}
start:

SerData VAR Byte(10)

SERIN 15,16572,[STR SerData\10]

DEBUG STR SerData\10
GOTO start


Regards,

Bruce Bates

Hubert
08-24-2005, 11:50 PM
The data rate of the GPS output stream is 4800 baud.·The code that I posted last time had the incorrect SERIN baudmode value.·When DEBUGing the stamp· every other character is missing.

This is the actual code:


' {$STAMP BS2}
start
SerData VAR Byte(10)

SERIN 15,188,[SerData]

DEBUG STR SerData
GOTO start



The BS2 manual states that there may be some trouble synchronizing at this rate due to the lack of a hardware input buffer.· The suggest using only simple variables and no formatters.· I have tried variations of this code but this has provided the best output thus far.

Chris Savage
08-25-2005, 12:26 AM
Hubert,

·· The reason that is happening is that DEBUG slows things down enough so that the next character is lost.· The BASIC Stamp has no FIFO Buffer, so if you're not ready to SERIN the next character when it's there, you miss it.· What you should do is get your 10 or 11 characters (How many are there?) and drop them into the array and then display them to the DEBUG screen using a second loop.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)

Hubert
08-30-2005, 12:06 AM
Chris,
I have been trying to use separate loops to accomplish what I am trying to do but I have been having some problems.
The stamp will not allow me to declare an array with any more than 20 elements. I have also tried creating several different arrays but the stamp keep telling me that my arrays are out of the variable space whenever the total number of elements exceeds 20. Having two different variables gets me two consecutive characters. So, I guess this is a step in the right direction but I need to figure out how to input more characters (about 50).

Chris Savage
08-30-2005, 01:21 AM
Hubert,

·· The reason you're getting the error is there are only 26 bytes total of variable space on a BS2.· In your original post you were declaring an array of ten elements (11).· If you need 20, you can probably do it, but if you need two consecutive readings to compare then you consider pulling the data out that you need, putting that into a separate variable, then getting the second reading into the same array and compare from there.

·· Otherwise you might need to consider a BASIC Stamp 2p series module.· These have 126 bytes of scratchpad RAM that you can use to store data in without using variable space.· Another interesting aspect of this is that the SERIN command contains a modifier which allows you to put the whole string right into the SPRAM without a loop.· With 126 bytes you could grab 6 readings for comparison, and still have a few bytes for averaging space.

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com (mailto:csavage@parallax.com)