- Fri Jun 01, 2012 2:01 pm
#145265
My project is to get latitude and longitude from the gps module and print it on the LCD using PIC 16F877
I wrote this code
but it does't work
also I try to increase the bound rate
but nothing appear to the lcd
any suggestions
thank u.
I wrote this code
but it does't work
also I try to increase the bound rate
but nothing appear to the lcd
Code: Select all
char uart_rd;
char uart[11];
// LCD module connections
sbit LCD_RS at LATB2_bit;
sbit LCD_EN at LATB3_bit;
sbit LCD_D4 at LATB4_bit;
sbit LCD_D5 at LATB5_bit;
sbit LCD_D6 at LATB6_bit;
sbit LCD_D7 at LATB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
// End LCD module connections
void main() {
TRISB = 0;
PORTB = 0x00;
UART1_Init(4800); // Initialize UART module at 9600 bps
Delay_ms(3000); // Wait for UART module to stabilize
//UART1_Write_Text("Start");
Lcd_Init(); // Initialize LCD
Lcd_Cmd(_LCD_CLEAR); // Clear display
Lcd_Cmd(_LCD_CURSOR_OFF); // Cursor off
lcd_out(1,1,"lcd");
delay_ms(1000);
uart1_write(0x08);
delay_ms(5000);
while(1) {
// uart1_write_text("$GPGGA,002153.000,3342.6618,N,11751.3858,W,1,10,1.2,27.0,M,-34.2,M,,0000*5E,0x0d,0x0a");
//uart1_write_text("$GPGLL,3723.2475,N,12158.3416,W,161229.487,A,A*41,0x0d,0x0a");
//uart1_write(0x0d);
//uart1_write(0x0a);
delay_ms(2000);
delay_ms(10000);
if(UART1_Data_Ready()) { // If data is received,
uart_rd=uart1_read();
// gps_value=gps_data(GPS_LATHIGH);
lcd_chr(2,12,uart_rd);
uart1_read_text(uart, ".", 15);
lcd_out(1,5, uart);
delay_ms(500);
}
}
}
any suggestions
thank u.