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.

need some help in coding 16f877

Status
Not open for further replies.
first of all you need to understand the bourd rate me your gps. If it is done, you want to setup similar bourd rate in your micro controller.
Then you want to wait untill '$' symbol arrives. When this symbol got you take an array of 7 size. And enter the incoming characters to that array till a ',' get . This is gps header. Check the header for a GPGGA or GPRMC or GPGLL. The time stamp will be the next. You may save this or not. The next field contain the latitude, and the next field longitude.
For all this you need to save this in an array.
Next you need to read the google map api to understand the plotting procedure.
Apply the lat long array to this
You done!

---------- Post added at 02:58 ---------- Previous post was at 02:51 ----------

first of all you need to understand the bourd rate me your gps. If it is done, you want to setup similar bourd rate in your micro controller.
Then you want to wait untill '$' symbol arrives. When this symbol got you take an array of 7 size. And enter the incoming characters to that array till a ',' get . This is gps header. Check the header for a GPGGA or GPRMC or GPGLL. The time stamp will be the next. You may save this or not. The next field contain the latitude, and the next field longitude.
For all this you need to save this in an array.
Next you need to read the google map api to understand the plotting procedure.
Apply the lat long array to this
You done!
 

hi sir,
i do the baud rate as the gps specification
but still i do not know what are the problem
i post the code i use it
please could you check the code
also,
how to draw the path on google earth since i do not have a background about google earth api
regards,
 

hi
this the code

////////////

#include "C:\Users\student\Desktop\gps\gps.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#use rs232(baud=9600, xmit=PIN_C6,rcv=PIN_C7,stream = xbee,errors) // xbee serial
#use rs232(baud=9600, xmit=PIN_C0,rcv=PIN_C1,stream = gps,errors) // gps serial
char comandoGPR[7] = "$GPRMC";
int i;
char linea[75] = "";
int bien=0;
int indices[13];
int cont=0;
int j;
int conta=0;
int byteGPS=-1;
void main()
{
setup_adc_ports(ALL_ANALOG);
setup_adc(ADC_CLOCK_INTERNAL);
setup_psp(PSP_DISABLED);
setup_counters(RTCC_INTERNAL,RTCC_DIV_1);
setup_timer_1(T1_DISABLED);
setup_timer_2(T2_DIV_BY_1,0,1);

// byteGPS=Serial.read(); // Read a byte of the serial port
// if (byteGPS == -1) { // See if the port is empty yet
// delay(100);
// } else {
// if(kbhit(gps)==true)
//{
while(1)
{
if(kbhit(gps))
{
byteGPS = fgetc(gps);
// if (byteGPS == -1) { // See if the port is empty yet
// delay_ms(100);
// } else {
fprintf(xbee,"jjff ");
linea[conta]=byteGPS; // If there is serial port data, it is put in the buffer
conta++;
// fprintf(byteGPS, BYTE);
fprintf(xbee,"%u",byteGPS);
//}
if (byteGPS==13){ // If the received byte is = to 13, end of transmission
// digitalWrite(ledPin, LOW);
cont=0;
bien=0;
for (i=1;i<7;i++){ // Verifies if the received command starts with $GPR
if (linea[i-1]==comandoGPR[i-1]){
bien++;
}
}
if(bien==6){ // If yes, continue and process the data
for (i=0;i<75;i++){
if (linea==','){ // check for the position of the "," separator
indices[cont]=i;
cont++;
}
if (linea=='*'){ // ... and the "*"
indices[12]=i;
cont++;
}
}
fprintf(xbee,"/r"); // ... and write to the serial port
fprintf(xbee,"/r");
fprintf(xbee,"---------------/r");
for (i=0;i<12;i++){
switch(i){
case 0 :fprintf(xbee,"Time in UTC (HhMmSs): ");break;
case 1 :fprintf(xbee,"Status (A=OK,V=KO): ");break;
case 2 :fprintf(xbee,"Latitude: ");break;
case 3 :fprintf(xbee,"Direction (N/S): ");break;
case 4 :fprintf(xbee,"Longitude: ");break;
case 5 :fprintf(xbee,"Direction (E/W): ");break;
case 6 :fprintf(xbee,"Velocity in knots: ");break;
case 7 :fprintf(xbee,"Heading in degrees: ");break;
case 8 :fprintf(xbee,"Date UTC (DdMmAa): ");break;
case 9 :fprintf(xbee,"Magnetic degrees: ");break;
case 10 :fprintf(xbee,"(E/W): ");break;
case 11 :fprintf(xbee,"Mode: ");break;
case 12 :fprintf(xbee,"Checksum: ");break;
}
for (j=indices;j<(indices[i+1]-1);j++){
fprintf(xbee,"%c",linea[j+1]);
}
fprintf(xbee,"/r");
}
fprintf(xbee,"---------------/r");
}
conta=0; // Reset the buffer
for (i=0;i<75;i++){ //
linea=' ';
}
}

}
}
}

////////////
regards,
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top