Help: PMB-648 SiRF GPS Module
BStephen
Posts: 5
Hi friends,
I have been scouring the internet for quite a few hours now (~10 hours to be exact) looking for a direction to coding the PMB-648 GPS module using SimpleIDE with the Parallax propeller board. I can't seem to figure out the direction I am supposed to take to use the GPS.
We are making a robot for the RoboMagellan competition utilizing the parallax propeller microcontroller, HC-SR04 Ultrasonic sensors and the PMB-648 SiRF GPS for the robot. We also decided to code the entire project in C, as we are all quite adept to using C, and have no time to learn another language (we have 6 other courses to take care of).
Can someone point me to the right direction or even post a demo code in C for the GPS?
Much thanks,
Stephen
I have been scouring the internet for quite a few hours now (~10 hours to be exact) looking for a direction to coding the PMB-648 GPS module using SimpleIDE with the Parallax propeller board. I can't seem to figure out the direction I am supposed to take to use the GPS.
We are making a robot for the RoboMagellan competition utilizing the parallax propeller microcontroller, HC-SR04 Ultrasonic sensors and the PMB-648 SiRF GPS for the robot. We also decided to code the entire project in C, as we are all quite adept to using C, and have no time to learn another language (we have 6 other courses to take care of).
Can someone point me to the right direction or even post a demo code in C for the GPS?
Much thanks,
Stephen
Comments
Welcome to the forums!
There are a couple of demos the show BasicStamp and Arduino C code:
http://learn.parallax.com/KickStart/28500
I'll see if I can dig up more in the mean time. Others may chime in with some more C stuff.
Maybe someone from the forums or Parallax has some C code.?
Jim
Thanks!
I have actually taken a look at the Spin, Stamp and Arduino C code for the GPS. The Spin and Stamp code are completely unknown to me, in fact, I only heard about these languages when I picked up the propeller which was a couple months ago. The Arduino C code from what I gathered uses softwareserial.h and tinygps.h, which, from research, are Arduino specific. I have tried looking for TinyGPS alternatives for the propeller to no luck.
I am still hoping to have a breakthrough... If I ever find out, I'll post it here. Until, then still "googling".
Cheers,
Stephen
Thanks for the input!
The way we have the robot set up, we can't use the serial port. This is because we have a netbook that takes input from a camera, to visual basic and over to the propeller.
I have question though, is it possible to have to different languages running on the propeller? If we could run both C and Spin, I think we might be able to get the GPS working. In the meantime, we resorted to using an Arduino for the GPS to figure what to do with the data. Ultimately, we want to use the propeller as the only microcontroller though.
Sorry if I have cause some confusion, I misunderstood what you were talking about with the serial port. Somehow when you said said serial port driver, I had thought of the port that the USB connection is made.
So, we did as you said, and it was a bit of a challenge, but here's a code that one of the group member was able to write out to get the data. However, there's a couple things, 1) most of the time, the string is able to grab the $GPGGA line, which we want, but sometimes it is grabbing other data and 2) when my group member used readStr() command, he was getting garbage and had to resort readChar() instead and store it into a char array to create a string.
Here's the code he came up with:
We had not known that was actually quite possible... That is quite helpful. However, with time constraints, we cannot go down the path as I can't seem to find it locally, and thus have to buy it on-line. The code posted above, more or less works and we have no idea why. It's the only lead we have with it and we are still messing with the code, so I'll update when I can.
Anyway, suffice to say, thank you for the help so far. I will continue to update this thread on our progress, and ask more questions as they come.
//
/**
* This is the main serial_inout program file.
*/
#include "simpletools.h"
#include "fdserial.h"
#define NONE 0
#define DEC 1
#define HEX 2
#define BIN 3
#define CHR 4
void serout(text_t *ser, int delay, char* string, int type, int val, int end);
void serin(text_t *ser, int wait, void (*function)(), int type, void* value);
void printnewline() {
print("\n");
}
int main(void)
{
int inpin = 3;
int outpin= 2;
int baud =9600;
int value = 0x55;
text_t *ser = fdserial_open(inpin, outpin, 0, baud);
int number, i;
char location[256];
i=-1;
pause(500);
print("SEROUT/SERIN DEMO\n");
while(1)
{
//serout(ser, 100, "HELLO", 0, value, CR);
//serout(ser, 1, "DEC VAL ", DEC, value, CR);
//serout(ser, 1, "HEX VAL ", HEX, value, CR);
//serout(ser, 1, "BIN VAL ", BIN, value, CR);
//serout(ser, 1, "CHR VAL ", CHR, value, CR);
//print("Enter DEC: ");
// serin(ser, 5000, printnewline, DEC, &value);
//print("Got DEC %d\n", value);
//print("Enter HEX: ");
//serin(ser, 5000, printnewline, HEX, &value);
//print("Got HEX %x\n", value);
//print("Enter BIN: ");
//serin(ser, 5000, printnewline, BIN, &value);
//print("Got BIN %b\n", value);
//print("Enter CHR: ");
serin(ser, 1, printnewline, CHR, &value);
//print("Got Char %c\n", value);
if(value=='$')
{
print("Got GPS \n");
do
{
i++;
location = readChar(ser);
} while(location!='\n');
location=0;
print("location %s",location);
}
}
return 0;
}
// i did not use this serout
void serout(text_t *ser, int delay, char* string, int type, int val, int end)
{
int n = 0;
int len = strlen(string);
for(n = 0; n < len; n++) {
writeChar(ser, string[n]);
pause(delay);
}
if(DEC == type) {
writeDec(ser, val);
pause(delay);
writeChar(ser, end);
}
else if(HEX == type) {
writeHex(ser, val);
pause(delay);
writeChar(ser, end);
}
else if(BIN == type) {
writeBin(ser, val);
pause(delay);
writeChar(ser, end);
}
else if(CHR == type) {
writeChar(ser, val);
pause(delay);
writeChar(ser, end);
}
else {
writeChar(ser, end);
}
}
void serin(text_t *ser, int wait, void (*function)(), int type, void* value)
{
char buf[33]; // big enough for hex, dec, bin, or char
while(--wait > -1) {
if(fdserial_rxReady(ser))
break;
pause(1);
}
if(wait < 0) {
writeLine(ser, "No input");
function();
return;
}
readStr(ser, buf, 33);
if(DEC == type) {
sscan(buf, "%d", value);
}
else if(HEX == type) {
sscan(buf, "%x", value);
}
else if(BIN == type) {
sscan(buf, "%b", value);
}
else if(CHR == type) {
sscan(buf, "%c", value);
}
}