system
May 22, 2012, 10:11am
1
I've got problem with reading data from gps. I wrote a simple program:
#include <SoftwareSerial.h>
int rxPin = 2;
int txPin = 3;
SoftwareSerial gpsSerial = SoftwareSerial(rxPin, txPin);
void setup()
{
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
Serial.begin(9600);
gpsSerial.begin(38400);
}
void loop()
{
char c;
while (gpsSerial.available())
{
c = gpsSerial.read();
Serial.println(c);
}
}
but I only get trash, does anybody know why?
system
May 22, 2012, 10:13am
2
but I only get trash,
Because you have a speed mismatch?
Because you have no inversion on your level converters?
Because you've not given us enough to go on.
system
May 22, 2012, 10:22am
3
GPS Venus 3.3
Ok, I changed the speed.
What do you mean with:
Because you have no inversion on your level converters?
system
May 22, 2012, 10:24am
4
Because you have no inversion on your level converters?
Because you didn't tell us what GPS unit you were using, I assumed it had RS232 levels, but now you've told us the one you're using, I can see that you don't need level conversion and inversion.
Which probably leaves speed mismatch.
What is the default line speed for the device?
system
May 22, 2012, 10:29am
6
What is the default line speed for the device?
Module outputs the standard NMEA-0183 or SkyTraq Binary sentences at a default rate of 9600bps (adjustable to 115200bps).
Which is not, of course, compatible with:
gpsSerial.begin(38400);
The GPS is not a MIDI device, so why are you trying to talk to it like it is?
system
May 22, 2012, 10:33am
7
I've changed already this line on:
gpsSerial.begin(9600);
Is it possible to receive correct data using this short program?
system
May 22, 2012, 10:34am
8
So why are you talking to it at 38.4k?
system
May 22, 2012, 10:36am
9
Is it possible to receive correct data using this short program?
Certainly should be. But, you have not provided any proof that you are not getting correct data.
system
May 22, 2012, 10:43am
13
I get this:
Now, provide some proof that the Arduino is talking to the serial monitor correctly. Put a Serial.print() statement in setup(), and make sure that that statement results in valid output on the serial monitor.
system
May 22, 2012, 10:47am
14
i did it and i get "ok" on serial monitor plus some characters
Serial.print("ok");
system
May 22, 2012, 11:05am
16
I use
Serial.println(c, HEX);
and I get
ok
78
FFFFFFFE
0
FFFFFFE0
FFFFFF80
78
0
0
FFFFFF80
FFFFFF80
FFFFFFF8
FFFFFF80
78
how convert or read it to NMEA data? I assumed that there are correct data