GPS Module Interfacing
GPS Module (SKG13BL) Description
The SKG13BL is a complete GPS engine module that features super sensitivity, ultra low power and small form factor. The GPS signal is applied to the antenna input of module, and a complete serial data message with position, velocity and time information is presented at the serial interface with NMEA protocol or custom protocol.
It is based on the high performance features of the MediaTek MT3337 single-chip architecture, Its –165dBm tracking sensitivity extends positioning coverage into place like urban canyons and dense foliage environment where the GPS was not possible before. The small form factor and low power consumption make the module easy to integrate into portable device like PNDs, mobile phones, cameras and vehicle navigation systems.
Features of GPS module
- Ultra high sensitivity: -165dBm
- Built-in 12 multi-tone active interference canceller
- Low power consumption: Typical 22mA@3.3V
- ±10ns high accuracy time pulse (1PPS)
- NMEA Output:GGA,GSA,GSV,RMC
- Advanced Features: AlwaysLocate; AIC
- QZSS,SBAS(WAAS,EGNOS,MSAS,GAGAN)
- UART interface: 4800/9600/38400/115200 bps
- Small form factor: 15x13x2.2mm
- RoHS compliant (Lead-free)
Applications
- LBS (Location Based Service)
- PND (Portable Navigation Device)
- Vehicle navigation system
- Mobile phone
- Extremely fast TTFF at low signal level
Interfacing of GPS Module
Pin assignment with LPC 2148
Pin Assignments | ||
---|---|---|
UART DB-9 Connector | LPC2148 Processor Lines | |
UART0 (P1) ISP PGM | TXD-0 | P0.0 |
RXD-0 | P0.1 | |
UART1 (P2) | TXD-1 | P0.8 |
RXD-1 | P0.9 |
Algorithm for GPS module interfacing with LPC2148
1) Start
2) Initialise UART0 or UART1 serial interfface using following i nstruction
U0LCR=0X83; //8-BIT Character lenth,NO parity,1 stop bit
U0DLL=97; //Baud rate=9600@PCLK=15Mhz
U0LCR=0X03;//Dlab=0
3) Receive GPS Message of location and longitude through UART module using function UARTGetch()
4) Store single character in Variable GPSData
5) Copy each single received character in array lattitude and longitude
6) Send this array characters to LCD for displaying message
7) END
Video Tutorial (Program Explanation and KEIL Project)
Embedded C Code
/* Project Name:- GPS Module Interfacing with LPC2148 using UART module */
/* Device:- LPC2148 */
/* Compiler:- KeilUvision4 */
/* Language:- Embedded C */
/* Visit www.wikinote.org for more Details */
/******************************************************************************************/
#include <lpc214x.h>
#include "serial.h"
#include "lcd.h"
unsigned int j;
unsigned char Gpsdata; // for incoming serial data
unsigned int finish =0; // indicate end of message
unsigned int pos_cnt=0; // position counter
unsigned int lat_cnt=0; // latitude data counter
unsigned int log_cnt=0; // longitude data counter
unsigned int flg =0; // GPS flag
unsigned int com_cnt=0; // comma counter
unsigned char lat[20]; // latitude array
unsigned char lg[20]; // longitude array
unsigned int i=0;
unsigned int fg=0;;
void gps(void);
int main(void)
{
lcd_init();
Uart0Init();
while(1)
{
gps();
lcdcmd(0x80);
DisplayLCD1("LT:");
DisplayLCD1(lat);
DisplayLCD1("N");
lcdcmd(0xC0);
DisplayLCD1("LG:");
DisplayLCD1(lg);
DisplayLCD1("E");
}
}
void gps()
{
while(finish==0){
Gpsdata = Uart0GetCh();
flg = 1;
if( Gpsdata=='$' && pos_cnt == 0) // finding GPRMC header
pos_cnt=1;
if( Gpsdata=='G' && pos_cnt == 1)
pos_cnt=2;
if( Gpsdata=='P' && pos_cnt == 2)
pos_cnt=3;
if( Gpsdata=='R' && pos_cnt == 3)
pos_cnt=4;
if( Gpsdata=='M' && pos_cnt == 4)
pos_cnt=5;
if( Gpsdata=='C' && pos_cnt==5 )
pos_cnt=6;
if(pos_cnt==6 && Gpsdata ==','){ // count commas in message
com_cnt++;
flg=0;
}
if(com_cnt==3 && flg==1){
lat[lat_cnt++] = Gpsdata; // latitude
flg=0;
}
if(com_cnt==5 && flg==1){
lg[log_cnt++] = Gpsdata; // Longitude
flg=0;
}
if( Gpsdata == '*' && com_cnt >= 5 && flg == 1){
lat[lat_cnt] ='\0'; // end of GPRMC message
lg[log_cnt] = '\0';
com_cnt = 0; // end of GPRMC message
lat_cnt = 0;
log_cnt = 0;
flg = 0;
finish = 1;
}
}
finish = 0;
pos_cnt = 0;
}
///////$GPRMC,194530.000,A,3051.8007,N,10035.9989,W,1.49,111.67,310714,,,A*74
Note:- As I am sending these AT Commands using UART , So i need to add Program for Serial Communication Hence Add Serial.c and Serial.h file
To download serial.c click on this link
To download serial.h click on this link
Note:- As I want to display Lattitude and Longitude values on LCD I have to add LCD.c and LCD.h files in my keil Project
To Download LCD.c click on dis link
To Download LCD.h click on dis link
Download GPS Module Project: Click Here |
---|
References
- WikiNote Foundation