here is my code it extract latt/longi first time only but when program executes 2nd time it stuck at serial() function and do not return to the main
i am using CCs compiler.
thankss ..
serial()
{
while(loop<25 )
{
ch=getch();
if(ch=='L')
{
ch=getch();
if(ch=='L')
{
for(loop;loop<25;loop++)
{
ch=getch();
cmd[loop]=ch;
}
}
}
}
loop=0;
ch=0;
}
void main(void)
{
while(1)
{
serial();
set_tris_c(0b10000000);
set_tris_D(0x00);
lcd_init();
delay_ms(20);
lcd_gotoxy(1,1);
printf(lcd_putc,"LAT=%c%c%c%c%c%c%c%c%c%c%c \n",cmd[1],cmd[2],cmd[3],cmd[4],cmd[5],cmd[6],cmd[7],cmd[8],cmd[9],cmd[10],cmd[11]); lcd_gotoxy(1,2);
printf(lcd_putc,"LON=%c%c%c%c%c%c%c%c%c%c%c%c",cmd[13],cmd[14],cmd[15],cmd[16],cmd[17],cmd[18],cmd[19],cmd[20],cmd[21],cmd[22],cmd[23],cmd[24]); }
}
i am using CCs compiler.
thankss ..
serial()
{
while(loop<25 )
{
ch=getch();
if(ch=='L')
{
ch=getch();
if(ch=='L')
{
for(loop;loop<25;loop++)
{
ch=getch();
cmd[loop]=ch;
}
}
}
}
loop=0;
ch=0;
}
void main(void)
{
while(1)
{
serial();
set_tris_c(0b10000000);
set_tris_D(0x00);
lcd_init();
delay_ms(20);
lcd_gotoxy(1,1);
printf(lcd_putc,"LAT=%c%c%c%c%c%c%c%c%c%c%c \n",cmd[1],cmd[2],cmd[3],cmd[4],cmd[5],cmd[6],cmd[7],cmd[8],cmd[9],cmd[10],cmd[11]); lcd_gotoxy(1,2);
printf(lcd_putc,"LON=%c%c%c%c%c%c%c%c%c%c%c%c",cmd[13],cmd[14],cmd[15],cmd[16],cmd[17],cmd[18],cmd[19],cmd[20],cmd[21],cmd[22],cmd[23],cmd[24]); }
}
Attachments
Last edited by a moderator: