Professional Documents
Culture Documents
c"
char output;
char NMEA[68];
char hora[1];
char i;
char *relogio;
char *longitude;
char *localizacao_N_S;
char limpa;
char limpam;
char flag;
sbit
sbit
sbit
sbit
sbit
sbit
LCD_RS
LCD_EN
LCD_D4
LCD_D5
LCD_D6
LCD_D7
at
at
at
at
at
at
RB2_bit;
RB3_bit;
RB4_bit;
RB5_bit;
RB6_bit;
RB7_bit;
sbit
sbit
sbit
sbit
sbit
sbit
LCD_RS_Direction
LCD_EN_Direction
LCD_D4_Direction
LCD_D5_Direction
LCD_D6_Direction
LCD_D7_Direction
at
at
at
at
at
at
TRISB2_bit;
TRISB3_bit;
TRISB4_bit;
TRISB5_bit;
TRISB6_bit;
TRISB7_bit;
ADCON1 = 0;
TRISA = 0b11111111;
cmcon = 0B11111111;
flag=0;
limpa=0;
limpam=0;
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
UART1_Init(9600);
Delay_ms(100);
while (1) {
if (UART1_Data_Ready() == 1) {
output = UART1_Read();
if(output == '$'){
i = 0;
do{
if (UART1_Data_Ready() == 1){
UART1_Read_Text(NMEA, ",", 10);
i = 1;
}
} while(i == 0);
if (Button(&PORTB, 1, 40, 1)){
Lcd_Cmd(_LCD_CLEAR);
flag++;
if(flag>2){
flag=0;
}
}
}
#line 241 "C:/Documents and Settings/Mateus/Desktop/mak pic c/GPS_18F877A.c"
switch (flag) {
case 0: tela1(); break;
case 1: tela2(); break;
case 2: tela3(); break;
}
}
else{
if(limpam==0){
Lcd_Cmd(_LCD_CLEAR);
limpam=1;
}
Lcd_Out(1,3,"Sem satelite");
limpa=0;
}
}
}
}
}
}