Shop OBEX P1 Docs P2 Docs Learn Events
Parallax GPS module help — Parallax Forums

Parallax GPS module help

DragonRiderLTDragonRiderLT Posts: 3
edited 2013-05-27 21:52 in General Discussion
Hello,

So, I am currently trying to interface an arduino with a Parallax GPS module. This module only has one serial communication line, whereas the arduino needs two. The module also has a Smart Mode so that when a command signal is sent, a specific byte(s) is sent back. To overcome the one line problem, I am using an AND gate to enable reading and writing only when I want to read or write.

What I'm doing with this makes complete sense in my head, but for some reason the GPS module only responds with 0's. The AND gate is fast enough to be used in this scenario; I've tested it with only reading.

Here is the data sheet for the GPS module: http://www.parallax.com/dl/docs/prod/acc/gpsreceivermanual1.0.pdf

Here is my code:
#include <SoftwareSerial.h>


SoftwareSerial mySerial(10, 11); // RX, TX




// AND gates are fast enough for 4800 baud rate!


int readPin = 2;
int writePin = 3;


int incomingByte;
int message;


byte zero = 0x00;
byte one = 0x01;
byte two = 0x02;
byte nine = 0x09;


void setup()  {
  
  pinMode(readPin, OUTPUT);
  pinMode(writePin, OUTPUT);
  
  Serial.begin(9600);
  
  mySerial.begin(4800);  
}


void loop()  {  
    
    digitalWrite(writePin, HIGH);  //enable the write gate
    mySerial.write("!GPS");
    mySerial.write(two);
    digitalWrite(writePin, LOW);
    
  
    digitalWrite(readPin, HIGH);  //enable the read gate
    Serial.flush();
    if (mySerial.available())  {
      incomingByte = mySerial.read();
      Serial.println(incomingByte);
    }
    digitalWrite(readPin, LOW);


  
}


Below is a schematic:
130525-231253.jpg
640 x 480 - 65K

Comments

Sign In or Register to comment.