I have the raw version of the "Parallax GPS". I wrote the code for it on the Basic Stamp 2 using a WAIT command until RMC and then I just pull pieces from the string and format it as I need it.
But on the Arduino I have issues. On the Arduino I just uploaded
// include the SoftwareSerial library so you can use its functions:
#include <SoftwareSerial.h>
#define rxPin 11
#define txPin 12
#define ledPin 13
// set up a new serial port
SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);
byte pinState = 0;
void setup() {
// define pin modes for tx, rx, led pins:
// set the data rate for the SoftwareSerial port
mySerial.begin(4800);
}
void loop() {
// listen for new serial coming in:
char someChar = mySerial.read();
// print out the character:
mySerial.print(someChar);
// toggle an LED just so you see the thing's alive.
// this LED will go on with every OTHER character received:
}
but I dont really care for this.
I simply connected the GPS to Pin 0 (rx)
and opened up the Serial Monitor, and set it for 4800 (as the GPS requires). The output is this (and keeps going)
I don't have any GPS module myself, I actually stumbled across your post while doing research on the PMB-248.
But here's a thought for your problem:
I suspect that, when using the Serial.read() function while there's nothing available to read, it produces some gibberish. I would change your code like this:
#define ledPin 13
void setup() {
Serial.begin(4800);
}
void loop() {
// listen for new serial coming in:
if(Serial.available()) {
char someChar = Serial.read();
// print out the character:
Serial.print(someChar);
// toggle an LED just so you see the thing's alive.
// this LED will go on with every OTHER character received:
}
}
I am using the hardware serial instead of the softwareserial library, because I have never used that one. For debugging, I recommend you use the Rx pin 0 and see what happens.
One more thought: You also get gibberish in the Serial window (on the PC) if you have the Arduino transmitting at 4800 baud but still have 9600 configured on the PC!
EDIT: Another thing I noticed while re-reading. You say you connect the GPS module to pin 0, but you have pin 11 configured as your RxPin :o
If the GPS module has an RS232 interface, you'll need inverter/level-shifters like a Max232.
The PIC-based device may have had this built-in, or may have just relied on the built-in protection diodes to ensure the device wasn't damaged by the negatives swings.
(Disclaimer: I've never seen or used this GPS module)
[edit]OK, just googled it - it has both TTL and RS232. Are you using pins 1 & 2 (no MAX232 required) for the interface, or pins 5 & 6 (Max232 required)?[/edit]