Projects › Projects › PIC16F877 and GPS module (EM-406A) › char uart_rd;char
May 31, 2012 at 9:53 am
#7943
osama
Participant
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) {
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);
}
}
}