miss85
Newbie level 2
hi,
i'm working on project using PIC microcotroller and GPS module (MTI-1). in my project, i need to send the data from GPS module to the modem. my problem is, i need only 1 protocol i.e GGA to be send to the modem. i've write the coding using C programming but still can't work. here i attached my coding. can anyone help me solve this problem...
i'm working on project using PIC microcotroller and GPS module (MTI-1). in my project, i need to send the data from GPS module to the modem. my problem is, i need only 1 protocol i.e GGA to be send to the modem. i've write the coding using C programming but still can't work. here i attached my coding. can anyone help me solve this problem...
unsigned short gps,protocol[5];
unsigned short in[76] = {'$','G','P','G','G','A'};
int i;
int find = 0;
void main()
{
Usart_Init(4800);
while(!find)
{
statement:
if (Usart_Data_Ready()) // If data is received
{
gps = Usart_Read(); // Read the received data
if(gps=='$')
{
for(i=1; i<6; i++)
{
if(Usart_Data_Ready())
gps = Usart_Read();
protocol = gps;
}//for
for (i=1; i<6; i++)
{
if (protocol==in) //comparing each data
{
if(Usart_Data_Ready())
find = 1;
//in = Usart_Read();
} else {
find = 0;
goto statement;
} //else
}
}
else { goto statement;} //for
} //if
for(i=6; i < 76; i++)
{
gps = Usart_Read();
in = gps;
}
for(i=0; i < 76; i++)
{
Usart_Write(in);
}
} //while
Delay_ms(1000);
}