Pages: [1]   Go Down
Author Topic: SKM53 to Nokia 5110 84x48 LCD  (Read 1104 times)
0 Members and 1 Guest are viewing this topic.
Greece
Offline Offline
Jr. Member
**
Karma: 0
Posts: 67
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi.
I need sketch to display values from a SKM53 GPS to a Nokia 5110 84x48 in order to study how to print this values.
I was trying so far to compile two working sketchs with NO success  smiley-cry
Can someone help ?
Thnx in advance
Logged

Greece
Offline Offline
Jr. Member
**
Karma: 0
Posts: 67
Arduino rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmmm...
Solved  smiley-cool
I dont know if this is the BEST WAY... but is working !!!


Code:
//-----------------------------------------------------------
#include <PCD8544.h>
#include <TinyGPS.h>
#include <NewSoftSerial.h>

// A custom glyph (a smiley)...
//static const byte glyph[] = { B00010000, B00110100, B00110000, B00110100, B00010000 };


static PCD8544 lcd;
//------------------------------------------------------------




unsigned long fix_age;

NewSoftSerial GPS(2,8);
TinyGPS gps;
void gpsdump(TinyGPS &gps);
bool feedgps();
void getGPS();
long lat, lon;
float LAT, LON;

void setup(){
  //------------------------------------------------------------
  // PCD8544-compatible displays may have a different resolution...
  lcd.begin(84, 48);
 
  // Add the smiley to position "0" of the ASCII table...
 // lcd.createChar(0, glyph);
  //------------------------------------------------------------
  GPS.begin(9600);
 // Serial.begin(115200);
}

void loop(){
  long lat, lon;
  unsigned long fix_age, time, date, speed, course;
  unsigned long chars;
  unsigned short sentences, failed_checksum;

  // retrieves +/- lat/long in 100000ths of a degree
  gps.get_position(&lat, &lon, &fix_age);

  // time in hh:mm:ss, date in dd/mm/yy
/*gps.get_datetime(&date, &time, &fix_age);
  year = date % 100;
  month = (date / 100) % 100;
  day = date / 10000;
  hour = time / 1000000;
  minute =  (time / 10000) % 100;
  second = (time / 100) % 100;
  Serial.print("Date: ");
  Serial.print(year); Serial.print("/");
  Serial.print(month); Serial.print("/");
  Serial.print(day);
  Serial.print(" :: Time: ");
  Serial.print(hour); Serial.print(":");
  Serial.print(minute); Serial.print(":");
  Serial.println(second);
*/
  getGPS();
 // Serial.print("Latitude : ");
 // Serial.print(LAT/100000,7);
 // Serial.print(" :: Longitude : ");
 // Serial.println(LON/100000,7);
 
  //-----------------------------------------------------------------------------
  // Just to show the program is alive...
 // static int counter = 0;

  // Write a piece of text on the first line...
  lcd.setCursor(0, 0);
  lcd.print("Lat:");
  lcd.print(LAT/100000,7);
 
  lcd.setCursor(0, 1);
  lcd.print("Lon:");
  lcd.print(LON/100000,7);
 
  lcd.setCursor(0, 2);
  lcd.print("ALT:");
  lcd.print(gps.altitude());

  // Write the counter on the second line...
  lcd.setCursor(0, 3);
  lcd.print("Course:");
  lcd.print(gps.course());
 
  lcd.setCursor(0, 4);
  lcd.print("Speed:");
  lcd.print(gps.f_speed_kmph());
 

  delay(500); 
//  counter++;
  //------------------------------------------------------------------------------
}

void getGPS(){
  bool newdata = false;
  unsigned long start = millis();
  // Every 1 seconds we print an update
  while (millis() - start < 1000)
  {
    if (feedgps ()){
      newdata = true;
    }
  }
  if (newdata)
  {
    gpsdump(gps);
  }
}

bool feedgps(){
  while (GPS.available())
  {
    if (gps.encode(GPS.read()))
      return true;
  }
  return 0;
}

void gpsdump(TinyGPS &gps)
{
  //byte month, day, hour, minute, second, hundredths;
  gps.get_position(&lat, &lon);
  LAT = lat;
  LON = lon;
  {
    feedgps(); // If we don't feed the gps during this long routine, we may drop characters and get checksum errors
  }
}

Hmmm.. i don't remember who originally wrote the two part of codes...sorry..
but one thing is sure...its NOT MINE !!!
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am also using the SKM53, and I am reading from the serial port.  The serial stream seems to have some errors but all the data is being received. Is there any resistors or other circuits that need to be connected between the Arduino (UNO for me) and the GPS module?
Logged

Pages: [1]   Go Up
Jump to: