Problem with displaying GPS data to uLCD-320 LCD

Hi,

I'm using an Arduino Mega, and I got a uLCD-320-PMD2 LCD connected to it. I have successfully interfaced the gps module to the arduino, and I was able to get some gps NMEA data displayed to the sofware monitor. Now I'm trying to display those same gps NMEA data to my uLCD-320-PMD2 LCD. I sucessfully compiled and uploaded the following code, but I just get a blank white display to my lcd. Any debugging help on that?

#include <LB_GPS.h> 

void setup(){ 
  //setup for Serial port 
  Serial.begin(19200); 

  delay(1000); 
  Serial.print(0x55,BYTE);   //initialize LCD 
  delay(1000); 

  Serial.print(0x42,BYTE);     //change background color 
  Serial.print(0xff,BYTE);     //color byte 1 
  Serial.print(0xff,BYTE);   //color byte 2  (White) 

  // print some info and ego boost 
  Serial.println(GPS.getLibVersion()); 
  
  // setup the GPS module 
  Serial.print("Setting up GPS..."); 
  
  // GPS warm-up time 
  delay(1000); 
  
  GPS.init();    
  Serial.println(" done!"); 
  
  delay(1000); 
  int i = 0; 

  Serial.print(0x53,BYTE);        //print string cmd 
  Serial.print(0x05,BYTE);           //x coord 
  Serial.print(0x00,BYTE);          //y1 coord 
  Serial.print(0x05,BYTE);          //y2 coord 
  Serial.print(0x00,BYTE);        //font 
  Serial.print(0x0f,BYTE);      //color 
  Serial.print(0xff,BYTE);      //color 
  Serial.print(0x01,BYTE);      //width 
  Serial.print(0x01,BYTE);     //height 
  
// print the raw data string arriving from the GPS 
  GPS.getRaw(100); 
  while(GPS.inBuffer[i]!='\0') 
  {  
    Serial.print(GPS.inBuffer[i],BYTE); 
    i++; 
  } 

  Serial.print(0x00,BYTE);         //Terminator    
  
} 

void loop(){ 

  // make a break before printing the next string 
  delay(10000); 

}

Hi navarro56,

On what serial port have you connected the lcd and the gps? When reading the code it looks like the lcd is connected to the serial port used for debugging/uploading hex.

Could it be that the following is also send to the lcd?

// print some info and ego boost
Serial.println(GPS.getLibVersion());

My suggestion would be to connect the lcd to another serial port on the Mega.

Another issue;
The main loop will wait 10 seconds after which it will wait another 10 seconds. Loop will never print something. You could move

int i = 0;

  Serial.print(0x53,BYTE);        //print string cmd
  Serial.print(0x05,BYTE);           //x coord
  Serial.print(0x00,BYTE);          //y1 coord
  Serial.print(0x05,BYTE);          //y2 coord
  Serial.print(0x00,BYTE);        //font
  Serial.print(0x0f,BYTE);      //color
  Serial.print(0xff,BYTE);      //color
  Serial.print(0x01,BYTE);      //width
  Serial.print(0x01,BYTE);     //height
  
// print the raw data string arriving from the GPS
  GPS.getRaw(100);
  while(GPS.inBuffer[i]!='\0')
  {  
    Serial.print(GPS.inBuffer[i],BYTE);
    i++;
  }

  Serial.print(0x00,BYTE);         //Terminator

to the loop and insert a clear screen before the "int i = 0;"

Hope it helps,

Jeroen

ps. if you use "Serial.write(value)" instead of "Serial.print(value, BYTE)" your code will be a lot smaller when compiled. Not sure about ram usage or speed.