I want to display data read from UART on 16×2 LCD with MikroC compiler & PIC16F877A microcontroller …
In my program I am sending data through USART terminal of MikroC, it is receiving correctly on virtual terminal in Proteus but not displaying on LCD.
Please check the code written in MikroC
sbit LCD_RS at RB0_bit;
sbit LCD_EN at RB1_bit;
sbit LCD_D4 at RB2_bit;
sbit LCD_D5 at RB3_bit;
sbit LCD_D6 at RB4_bit;
sbit LCD_D7 at RB5_bit;
sbit LCD_RS_direction at TRISB0_bit;
sbit LCD_EN_direction at TRISB1_bit;
sbit LCD_D4_direction at TRISB2_bit;
sbit LCD_D5_direction at TRISB3_bit;
sbit LCD_D6_direction at TRISB4_bit;
sbit LCD_D7_Direction at TRISB5_bit;
char gps;
void main()
{
Lcd_Init();
Lcd_Cmd(_LCD_CLEAR);
Lcd_Cmd(_LCD_CURSOR_OFF);
Lcd_Out(1,1,"log");
Lcd_Out(2,1,"lat");
UART1_Init(9600);
here:
if (UART1_Data_Ready() == 1)
{ // if data is received
gps = UART1_Read();
delay_ms(100);
}
Lcd_Out(1,6,gps);
Delay_ms(2000);
goto here;
}