info from gps to LCD

hi
i can not get any info from the gps to the lcd(4bit lcd)

/*

Ejemplo de conexi?n de un m?dulo GPS de Parallax a Arduino

Ejemplo 1: Escucha e interpreta la informaci?n proporcionada por el GPS.

Igor Gonz?lez Mart?n. 05-04-2007
igor.gonzalez.martin@gmail.com

Lo que hace es interpretar el comando $GPRMC al recibirlo del GPS
y sacar el resultado por pantalla.

Ejemplo:

$GPRMC

Recommended minimum specific GPS/Transit data

eg1. $GPRMC,081836,A,3751.65,S,14507.36,E,000.0,360.0,130998,011.3,E62
eg2. $GPRMC,225446,A,4916.45,N,12311.12,W,000.5,054.7,191194,020.3,E
68

225446 Time of fix 22:54:46 UTC
A Navigation receiver warning A = Valid position, V = Warning
4916.45,N Latitude 49 deg. 16.45 min. North
12311.12,W Longitude 123 deg. 11.12 min. West
000.5 Speed over ground, Knots
054.7 Course Made Good, degrees true
191194 UTC Date of fix, 19 November 1994
020.3,E Magnetic variation, 20.3 deg. East
*68 mandatory checksum

eg3. $GPRMC,220516,A,5133.82,N,00042.24,W,173.8,231.8,130694,004.2,W*70
1 2 3 4 5 6 7 8 9 10 11 12

1 220516 Time Stamp
2 A validity - A-ok, V-invalid
3 5133.82 current Latitude
4 N North/South
5 00042.24 current Longitude
6 W East/West
7 173.8 Speed in knots
8 231.8 True course
9 130694 Date Stamp
10 004.2 Variation
11 W East/West
12 *70 checksum

eg4. for NMEA 0183 version 3.00 active the Mode indicator field is added
$GPRMC,hhmmss.ss,A,llll.ll,a,yyyyy.yy,a,x.x,x.x,ddmmyy,x.x,a,m*hh
Field #
1 = UTC time of fix
2 = Data status (A=Valid position, V=navigation receiver warning)
3 = Latitude of fix
4 = N or S of longitude
5 = Longitude of fix
6 = E or W of longitude
7 = Speed over ground in knots
8 = Track made good in degrees True
9 = UTC date of fix
10 = Magnetic variation degrees (Easterly var. subtracts from true course)
11 = E or W of magnetic variation
12 = Mode indicator, (A=Autonomous, D=Differential, E=Estimated, N=Data not valid)
13 = Checksum

*/
#define LCD_RS 8 // Register select
#define LCD_EN 9 // Enable
#define LCD_D4 4 // Data bits
#define LCD_D5 5 // Data bits
#define LCD_D6 6 // Data bits
#define LCD_D7 7 // Data bits
#include <string.h>
#include <ctype.h>

int ledPin = 13; // PIN para test
int rxPin = 0; // PIN de TX
int txPin = 1; // PIN de TX
int byteGPS=-1;
char linea[300] = "";
char comandoGPR[7] = "$GPRMC";
int cont=0;
int bien=0;
int conta=0;
int indices[13];

void lcd_strobe()
{
digitalWrite(LCD_EN,HIGH);
digitalWrite(LCD_EN,LOW);
}
void lcd_write(byte c)
{
if(c & 0x80) digitalWrite(LCD_D7,HIGH); else digitalWrite(LCD_D7,LOW);
if(c & 0x40) digitalWrite(LCD_D6,HIGH); else digitalWrite(LCD_D6,LOW);
if(c & 0x20) digitalWrite(LCD_D5,HIGH); else digitalWrite(LCD_D5,LOW);
if(c & 0x10) digitalWrite(LCD_D4,HIGH); else digitalWrite(LCD_D4,LOW);
lcd_strobe();
if(c & 0x08) digitalWrite(LCD_D7,HIGH); else digitalWrite(LCD_D7,LOW);
if(c & 0x04) digitalWrite(LCD_D6,HIGH); else digitalWrite(LCD_D6,LOW);
if(c & 0x02) digitalWrite(LCD_D5,HIGH); else digitalWrite(LCD_D5,LOW);
if(c & 0x01) digitalWrite(LCD_D4,HIGH); else digitalWrite(LCD_D4,LOW);
lcd_strobe();
delayMicroseconds(20);
}

/*

  • Clear and home the LCD
    */

void
lcd_clear(void)
{
digitalWrite(LCD_RS,LOW);

lcd_write(0x1);
delay(2);
}

/* write a string of chars to the LCD */

void
lcd_puts(const char * s)
{
digitalWrite(LCD_RS,HIGH); // write characters

while(*s) lcd_write(*s++);
}

/* write one character to the LCD */

void
lcd_putch(byte c)
{
digitalWrite(LCD_RS,HIGH); // write characters

lcd_write(c);
}

/*

  • Go to the specified position
    */

void
lcd_goto(byte pos)
{
digitalWrite(LCD_RS,0);

lcd_write(0x80 + pos);
}

/* initialise the LCD - put into 4 bit mode */

void
lcd_init(void)
{
pinMode(LCD_D7,OUTPUT);
pinMode(LCD_D6,OUTPUT);
pinMode(LCD_D5,OUTPUT);
pinMode(LCD_D4,OUTPUT);
pinMode(LCD_EN,OUTPUT);
pinMode(LCD_RS,OUTPUT);

digitalWrite(LCD_RS, LOW); // write control bytes

delay(20);// power on delay

digitalWrite(LCD_D4, HIGH); // init!
digitalWrite(LCD_D5, HIGH); //
lcd_strobe();
delay(5);

lcd_strobe();// init!
delayMicroseconds(100);

lcd_strobe();// init!
delay(5);

digitalWrite(LCD_D4, LOW); // set 4 bit mode
lcd_strobe();
delayMicroseconds(40);

lcd_write(0x28);// 4 bit mode, 1/16 duty, 5x8 font, 2lines
lcd_write(0x0C);// display on
lcd_write(0x06);// entry mode advance cursor
lcd_write(0x01);// clear display and reset cursor
}

void setup() {
pinMode(ledPin, OUTPUT); // Inicializando PIN-es
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
Serial.begin(4800);
for (int i=0;i<300;i++){ // Incializaci?n del buffer de recepci?n
linea*=' ';*

  • } *
    }
    void loop() {
  • digitalWrite(ledPin, HIGH);*
  • byteGPS=Serial.read(); // Lee un byte del puerto serie*
  • if (byteGPS == -1) { // Comprueba si hay algo en el buffer del puerto serie*
  • delay(100);*
  • } else {*
  • linea[conta]=byteGPS; // Si hay algo lo escribe en el buffer de recepci?n.*
  • conta++; *
  • printByte(byteGPS);*
  • if (byteGPS==13){ // Si el byte recibido es 13 = Fin de comando*
  • digitalWrite(ledPin, LOW);*
  • cont=0;*
  • bien=0;*
  • for (int i=1;i<7;i++){ // Comprueba si el comando recibido es un &GPRMC*
    _ if (linea*==comandoGPR[i-1]){_
    _
    bien++;_
    _
    }_
    _
    }_
    _
    if(bien==6){ // Si lo es ... procesa la info del comando ..._
    _
    for (int i=0;i<300;i++){_
    _ if (linea==','){ // ... busca la posici?n de las ","
    indices[cont]=i;
    cont++;
    }
    if (linea==''){ // ... y del ""
    indices[12]=i;
    cont++;
    }
    }
    Serial.println(""); // ... y escribe la info en el puerto serie.
    Serial.println("");
    Serial.println("---------------");
    for (int i=0;i<12;i++){
    switch(i){_

    case 0 :lcd_puts("Hora en UTC (HhMmSs): ");break;
    _ case 1 :Serial.print("Estado (A=OK,V=KO): ");break;_
    case 2 :lcd_puts("Latitud: ");break;
    _ case 3 :Serial.print("Direccion (N/S): ");break;
    case 4 :Serial.print("Longitud: ");break;
    case 5 :Serial.print("Direccion (E/W): ");break;
    case 6 :Serial.print("Velocidad sobre superficie (nudos): ");break;
    case 7 :Serial.print("Direccion del movimiento (grados): ");break;
    case 8 :Serial.print("Fecha en UTC (DdMmAa): ");break;
    case 9 :Serial.print("Grados de variacion magnetica: ");break;
    case 10 :Serial.print("Variacion magnetica (E/W): ");break;
    case 11 :Serial.print("Modo: ");break;
    case 12 :Serial.print("Checksum: ");break;
    }
    for (int j=indices;j<(indices[i+1]-1);j++){
    Serial.print(linea[j+1]);
    }
    Serial.println("");
    }
    Serial.println("---------------");
    }
    conta=0; // Reinicia el contador de posici?n en el buffer*

    * for (int i=0;i<300;i++){ // de recepci?n y el propio buffer*
    linea*=' ';
    }
    }
    }
    }*_

Start by creating two small programs, one that reads the gps and displays the data in the debug monitor and one that puts data on the lcd. once you have this you can cut and paste the parts you need into the final program.