fawadbutt
Member level 3
- Joined
- Oct 29, 2010
- Messages
- 61
- Helped
- 4
- Reputation
- 8
- Reaction score
- 4
- Trophy points
- 1,288
- Location
- Lahore, Pakistan, Pakistan
- Activity points
- 1,754
i m try to receiving GPS data and filter the time , longitude and Latitude in $GPGGA . i m using hitech compiler and 16f877 controller here is my code :
my receiving the all data but than filter and try to getting $GPGGA 'msg_rec_flag' not high, no thing store in Rx_Buff[] array.
plz help me.
Code:
///////////////Serial Interrupt Setting/////////////////////
//////////////////Rx Interupt////////////////////////////
void interrupt receive(void)
{
if(RCREG!=0X0D)
{
Rx_Buff[Rx_Data]=RCREG;//GPS Receivng
if(Rx_Buff[0]=='$' && Rx_Buff[1]=='G' && Rx_Buff[2]=='P' )//&& Rx_Buff[3]=='G' && Rx_Buff[4]=='G' && Rx_Buff[5]=='A')
{
Rx_Buff[Rx_Data]=RCREG;
msg_rec_flag=1;
}
Rx_Data++;
}
else
{
Rx_Buff[Rx_Data]='\0';//if GSM end of string gsm send '0x0D' Enter command
Rx_Data=0;
string_end=1;
}
RCIF=0;
}
my receiving the all data but than filter and try to getting $GPGGA 'msg_rec_flag' not high, no thing store in Rx_Buff[] array.
Code:
//////-Msg Filter-//////////////////////////
if(string_end==1 && msg_rec_flag==1)
{
string_end==0;
msg_rec_flag=0;
strcpy(full_msg,Rx_Buff);///Copy the String
memset(Rx_Buff,'-',sizeof Rx_Buff);//Clear the String
lcd_text("Msg Receive ",_1st+5);
/////-Get Time///////////////////////////////////
for(unsigned char i=0;i<6;i++)
{
GGA_Time[i]=full_msg[i+7];
}
//////-Get-Latitute///////////////////////////////
for (unsigned char i=0;i<11;i++)
{
GGA_Lat[i]=full_msg[i+18];
}
//////-Get_Longitute-////////////////////////////
for (unsigned char i=0;i<12;i++)
{
GGA_Lon[i]=full_msg[i+30];
}
}
/////////-Display_GPS-////////////////////////////////
lcd_text(Rx_Buff,_3rd);
lcd_text(GGA_Time,_2nd);
//lcd_text(GGA_Lat,_3rd);
//lcd_text(GGA_Lon,_4th);
plz help me.