Parallax GPS invalid mode


hi, i'm new @ programming arduino boards. i'm having problem getting parallax gps work. using same code , gps module indicated on following link: http://www.arduino.cc/playground/tutorials/gps. i'm using atmega duemilanove 368.

and reference here exact code using:

code: [select]
#include <string.h>
#include <ctype.h>

int ledpin = 13;                  // led test pin
int rxpin = 0;                    // rx pin
int txpin = 1;                    // tx tx
int bytegps=-1;
char linea[300] = "";
char comandogpr[7] = "$gprmc";
int cont=0;
int bien=0;
int conta=0;
int indices[13];

void setup() {
 pinmode(ledpin, output);       // initialize led pin
 pinmode(rxpin, input);
 pinmode(txpin, output);
 serial.begin(4800);

 for (int i=0;i<300;i++){       // initialize buffer received data
   linea[i]=' ';
 }  
}

void loop() {

 digitalwrite(ledpin, high);
 bytegps=serial.read();         // read byte of serial port
 if (bytegps == -1) {           // see if port empty yet
   delay(100);
 } else {
   linea[conta]=bytegps;        // if there serial port data, put in buffer
   conta++;  

   serial.print(bytegps, byte);

   if (bytegps==13){            // if received byte = 13, end of transmission
     digitalwrite(ledpin, low);
     cont=0;
     bien=0;
     for (int i=1;i<7;i++){     // verifies if received command starts $gpr
       if (linea[i]==comandogpr[i-1]){
         bien++;
       }
     }
     if(bien==6){               // if yes, continue , process data
       for (int i=0;i<300;i++){
         if (linea[i]==','){    // check position of  "," separator
           indices[cont]=i;
           cont++;
         }
         if (linea[i]=='*'){    // ... , "*"
           indices[12]=i;
           cont++;
         }
       }

   
       for (int i=0;i<12;i++){
         switch(i){
           case 0 :serial.print("time in utc (hhmmss): ");break;
           case 1 :serial.print("status (a=ok,v=ko): ");break;
           case 2 :serial.print("latitude: ");break;
           case 3 :serial.print("direction (n/s): ");break;
           case 4 :serial.print("longitude: ");break;
           case 5 :serial.print("direction (e/w): ");break;
           case 6 :serial.print("velocity in knots: ");break;
           case 7 :serial.print("heading in degrees: ");break;
           case 8 :serial.print("date utc (ddmmaa): ");break;
           case 9 :serial.print("magnetic degrees: ");break;
           case 10 :serial.print("(e/w): ");break;
           case 11 :serial.print("mode: ");break;
           case 12 :serial.print("checksum: ");break;
         }
       
         for (int j=indices[i];j<(indices[i+1]-1);j++){
           serial.print(linea[j+1]);
         }
         serial.println("");
       }
     
   
     }
 
     conta=0;                    // reset buffer
     for (int i=0;i<300;i++){    //
       linea[i]=' ';            
     }                
   }
 }
}



after uploading code onto board , putting wire in pin 0 results. not readings except, if i'm either north/south, east/west, utc time, utc date , if status (valid) or v (invalid) , v (invalid) status. furthermore, utc time , date wrong. have faulty gps module? or coding wrong in way?

p.s. i'm using 4800 baud indicated on serial monitor

hi, tried hardware combination, , works seamless me. status v doesn't have mean you're having fault device. means gps isn't ready give information required set proper gps datasignal , location.

first startup takes while, because set time. leave on several minutes in open sky.


Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Parallax GPS invalid mode


arduino

Comments