cannot get correct and formatted data from gps

Hello, I am new in arduino programming. I have recently started a project on gps tracking. I have interfaced gps with arduino uno(Tx to Rx). BUt in serial monitor, I got lon:999999999 and lat:99999999…WHat can be the errors?? Pls help me out…
Thanks!.

My code is here…

#include <SoftwareSerial.h>
#include “TinyGPS.h”

long lat,lon; // create variable for latitude and longitude object
SoftwareSerial gpsSerial(2, 3);
TinyGPS gps; // create gps object

void setup(){
Serial.begin(9600); // connect serial
Serial.println(“starting communication to gsm…”);
gpsSerial.begin(9600); // connect gps sensor
}
void loop(){
while(gpsSerial.available()){ // check for gps data
Serial.println(“reading data from gsm…”);
//if(gps.encode(gpsSerial.read())){ // encode gps data
//delay(2000);
if(gpsSerial.read()){
Serial.println(“reading lattitude and longitude…”);
gps.encode(gpsSerial.read());
gps.get_position(&lat,&lon); // get latitude and longitude
// display position
Serial.print("Position: ");
Serial.print("lat: “);Serial.print(lat);Serial.println(” ");// print latitude
Serial.print("lon: ");Serial.println(lon); // print longitude
}
}
}

I have used tinygps.h header file. But output is in 999999 format?? Did i get a garbage value??

That is the result when no valid GPS messages are received. There are many possible reasons for this, including GPS not functioning, not seeing satellites, incorrectly wired, incorrect communications parameters, etc. It is impossible to guess, from the extremely limited information that you posted, which it could be.

if so,,, i have to test and verify my gps module gtpa010 first...For this i can use hyperterminal test.
I need a verified gps data reading code for a reference......It would be my pleasure if someone do this at my email address: dpnastha@gmail.com or reply here..

Thank you!!

(deleted)

Upon 1st powering-up, a GPS module may need up to 20+ minutes to read the satellite data and discover where in the world it is located. Recent tests with multiple Ublox 6 modules from a Chinese vendor took 18 minutes and 22 minutes. During this time, the units need unobstructed sky view. After the 1st full 3D lock, the next power on within a short downtime initializes much quicker, usually in under 60 seconds and often in under 10 seconds.

Depending of the NMEA command that you are receiving you can have one that tells you if the GPS had get already fix or not. You can send to yours serial port the command that you receive from your GPS instead of only the LAT and LONG.

Is the GPS output rs232 or TTL format?

zoomkat:
Is the GPS output rs232 or TTL format?

Module-centric:

TTL:
http://www.ebay.com/itm/RYN25AI-10Hz-UART-interface-high-performance-GPS-Glonass-antenna-module-battery-/171339542977

RS232:
http://www.ebay.com/itm/RYN25DI-10Hz-RS232-interface-high-performance-GPS-Glonass-antenna-module-battery-/171340780546