How to Interface GPS With 8051 Microcontroller

Share Embed Donate


Short Description

gps...

Description

How to interface GPS with 8051 Microcontroller (AT89C51) The GPS module continuously transmits serial data (RS232 protocol) in the form of sentences according to NMEA to NMEA standards. The standards. The latitude and longitude values of the location are contained in the GPGGA sentence (refer  NMEA  NMEA format). format). In this program, these values are extracted from the GPGGA sentence and are displayed on  LCD.

The serial data is taken from the GPS module through  MAX232 into the SBUF register of  8051  8051 controller (refer  serial   serial interfacing with 8051). 8051) . The serial data from the GPS receiver is taken by using the Serial Interrupt Serial Interrupt of the controller. This data consists of a sequence of NMEA sentences from which GPGGA sentence is identified and processed.

The extraction of location values is done as follows. The first six bytes of the data received are compared with the pre-stored ($GPGGA) string and if m atched then only data is further accounted for; otherwise the process is repeated again. From the comma delimited GPGGA sentence, latitude and longitude positions are extracted by finding the respective comma positions and extracting the data. The latitude and longitude positions extracted are displayed on th eLCD interfaced with AT89C51.

To obtain more details (other than latitude and longitude) longitude) from the GPS receiver, GPRMS sentence can be used. Refer  next  next article.

The circuit connections are as follows:

Receiver1 (R1) of MAX232 has been used for the serial communication. The receiver pin of GPS module is connected to R 1IN (pin13) of MAX232. R 1OUT (pin 12) of MAX232 is connected to RxD (P3.0) of  AT89C51.   AT89C51.

Pins 1-3 of port P1 (P1.0, P1.1 & P1.2 respectively) of AT89C51 are connected to the control pins (RS, R/W& EN) of LCD. The data pins of LCD are connected to Port P2 of the controller. The latitude and longitude positions are displayed on the LCD. The GPS module continuously transmits serial data (RS232 protocol) in the form of sentences according to NMEA to NMEA standards. The standards. The latitude, longitude, time, date and speed values of the receiver are contained in the GPRMC sentence as given in the following example (also refer  NMEA  NMEA format f or or other sentences). In this project, these values are extracted from the GPRMC sentence and are displayed on LCD. on LCD.

Example : $GPRMC,132455.970,A,2651.0145,N,07547.7051,E,0.50,342.76,301010,,,A*64

where: RMC

Recommended Minimum sentence C

132455.970

Fix taken at 13:24:55.970 UTC

 A

Status A=Active or V=Void.

2651.0145, N

Latitude 26 deg 51.0145' N

07547.7051, E

Longitude 075 deg 47.7051' E

0.50

Speed over the ground in knots

342.76

Track angle in degrees True

301010

Date : 30th of October 2010

Empty field (xxx.x, y)

Magnetic Variation

*64

The checksum data, always begins with *

The serial data is taken from the GPS module

through MAX232 into the SBUF register

of  8051 controller (refer   serial interfacing with 8051). The serial data from the GPS receiver is taken by using the Serial Interrupt of the controller. This data consists of a sequence of NMEA sentences from which GPRMC sentence is identified and processed.

The extraction of required values is done as follows. The first six bytes of the data received are compared with the pre-stored ($GPRMC) string and if matched then only data is further accounted for; otherwise the process is repeated again. From the comma delimited GPRMC sentence, latitude, longitude, date, time, speed values are extracted by finding the respective comma positions. The values thus extracted are displayed on the LCD interfaced with AT89C51.

The circuit connections are as follows:

Receiver1 (R1) of MAX232 has been used for the serial communication. The receiver pin of GPS module is connected to R 1IN (pin13) of MAX232. R 1OUT (pin 12) of MAX232 is connected to RxD (P3.0) of   AT89C51.

Pins 1-3 of port P1 (P1.0, P1.1 & P1.2 respectively) of AT89C51 are connected to the control pins (RS, R/W& EN) of LCD. The data pins of LCD are connected to Port P2 of the controller. The latitude and longitude positions are displayed on the LCD.

/* Basic program to show latitude and longitude on LCD extracted from GPGGA statement */ #include #define port2 P2 sbit rs = P1^0; sbit rw = P1^1;

sbit e = P1^2; char info[70]; char test[6]={"$GPGGA"}; char comma_position[15]; unsigned int check=0,i; unsigned char a; void receive_data(); void lcd_latitude(); void lcd_longitude(); //DELAY FUNCTION void delay(unsigned int msec) { int i,j ; for(i=0;i
View more...

Comments

Copyright ©2017 chineseinfo.info Inc.
SUPPORT chineseinfo.info