Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

GPS/SMS tracking system implementation problem

Status
Not open for further replies.

amarhw

Junior Member level 1
Junior Member level 1
Joined
Nov 15, 2008
Messages
15
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Location
Uk
Activity points
1,406
sms tracking

Hi
I am trying to do this project using GPS+SMS modules and 8051 (XAG49 ) microcontroller with RIDE simulator using C language.
The idea is :
The SMS module receive a massage then the location send back to that sender .
Therefore I should connect the SMS and GPS module with the MC using UART0 and UART1 in the same time. When the request of location received, the MC should read it and read the coordinates ( which is a long string of data ,therefore, I think that I should store it in the RAM then take only the coordinates from it ) and send it back to the sender.
The problems is :
How I can read from UART0 and UART1 using C language?
How can I save the string of data that the GPS send continuously in the RAM to take the part contain the coordinates ? Or there are other idea to take the useful part from the data string that the GPS send in a continuously.
Thanks in advance .
 

gps system implementation

Let us assume u have used UART0 for GPS and UART1 for USER INTERFACE
Here there are two points.

1.The gps transmits position data to micro controller every 1 sec once u power it up.
so, u can get a position at any moment u want.No need of opening the uart port for receiving data every time because u have to send the data when and only query comes from user.
So, use a logic such that u can collect data from gps when only required.
Try to use some logic circuit in between ur gps and UART.
So, enable the circuit when and only gps position is required.

2.u have control over collection of gps data
but u can't control user interface because u don't know when user asks u a query
so, always keep doors open for checking a user interrupt.
when interrupt occurs and u have recieved request, enable the logic circuit u have used for gps data and and collect gps position.

Collecting GPS data.........

U have to know the NMEA protocol before collecting the GPS data
There are several formats of GPS positions that are output by ur GPS receiver
Try to study them and decide which one u want

Logic for collecting GPS data ...........

GPS positions generally comes with a $ first and then format type GPGGA,GPRMC,GPGSV,GPGSA,.......
so, while collecting data over uart first collect aroung 25 to 30 bytes and then check wether for example $GPGGA has arrived in sequence
If required data has arrived, collect the next position data after $GPGGA and those represent ur position data which must be transmitted over UART1 to user.

If u want to know how to collect data over uart
simply, enable the interrupt.
collect byte data from SBUF
and then that byte data into ur required variable.

I am attaching frame formats data below for ur reference
 

    amarhw

    Points: 2
    Helpful Answer Positive Rating
implmentation of gps in tracking system

Thanks a lot for your replay and the attachment is very useful.
I studied the NMEA protocol and the most useful sentence is start with $GPRMC which contain the minimum information required like time, date, status of signal (available or not), latitude, longitude, speed and other information that I do not need. I want to connect the GSM module with UART0 because it is easier to manage where I will read the message from GSM module that include the request for location and send the location through same port.
Then I will connect the GPS to the other UART (port 1 pins 4&5). I find that I do not need to connect the Rx and Tx poets of the GPS to the MC, I can just can connect the Tx.
Actually I think it is easier to program the MC to do this job instead of building a logic circuit .
My problem is:
How can I receive data from UART0 and from pin 1.4?
I try what you sade and check what will I get.
But is you have a C code for receiving from UART and one of MC pins it will be very helpful.
Thanks a lot
 

gps sms

ya u need not connect to RX pin of GPS receiver
I shall provide u with basic idea of how to collect data over uart....

void Uart0Receive() interrupt 4
{
unsigned char data;
unsigned char FirstByteReceived;
unsigned char Packetlength;
if( data == '$)
{
Packetlength = 0;
FirstByteReceived = 1;
}
if((FirstByteReceived == 1) && (Packetlength < =25))
{
//collect data into ur variable
Packetlength++;
}
}
if(Packetlength == 25) //25 or more based on ur requirement
{
FirstByteReceived = 0;
Packetlength = 0;
}
//after collecting the data into ur variable now check wehter GPGGA/GPRMC has been
received as first three bytes.if u have received correctly process the collected
data as per ur requirement.
}
 

tracking sms sender

Hi
I tried to collect information from UART0 using (scon and gets) but I could not.
Can you give me if possible an example how to collect from UART)?
Thanks for your help
 

mc gps sms

u can use the above code.
u will b having a sfr(SBUF in 8051) from which u have to collect data

ex: unsigned char receivedata;
receivedata = SBUF;

so, u will be receiving the data into varibale
try to put the value into array

ReceviedSequence = receivedata;
i++;

Everytime a byte of data is received over serial port automatically RI will become high and leads to ISR which u write
In this ISR collect the data as above
 

gps tracking system problems

Hi
I tried to write a code just to read from UART0
#include<stdio.h>
#include<regxag49.h>
unsigned char receiveddata;
unsigned char array[10];
unsigned int i;
void main() interrupt 4
{
WDCON =0;
WFEED1=0xa5;
WFEED2=0x5a;
S0CON=0x52;
TMOD=0x20;
RTL1=238;
TH1=0xfa;
TL1=238 ;
TR1=1;
for (i=0;i<10;i++)
{
receiveddata=S0BUF;
array=receiveddata;
}
for (i=0;i<10;i++)
{
printf("%c",array);
}
}
the problem is I've got
0000000000
Can you tell me what is the problem ?
I want to sent the baud rate to 4800 ,are my settings correct?
Thanks a lot
 

gps tracking system

Hi

I tried to read data character after character Then I write this code #include <regxag49.h>
#include <stdio.h>
char message [800];
void read (unsigned char rch);
unsigned char rch;
unsigned int i,j,m;
void main(void)
{
WDCON =1;
WFEED1=0xa5;
WFEED2=0x5a;
TMOD=0x20;
S0CON=0x52;
TH1=0xfa;
RTL1=238;
TL1=0xfa ;
TR1=1;
read (rch);
i=0;
while (message!='\0')
{
printf("%c",message);
i++;
}
}
//----------------------------------------
void read (unsigned char rch)
{
for (m=0;m<800;m++)
{
while (!RI);
RI=0;
message[m]=SBUF;
}
}


The problem is that the execution stop in the (while (!RI);) step
Can anyone tell me what is the problem ?
Any idea will be appreciated.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top