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