// LCD module connections
sbit LCD_RS at LATD0_bit;
sbit LCD_EN at LATD1_bit;
sbit LCD_D4 at LATB0_bit;
sbit LCD_D5 at LATB1_bit;
sbit LCD_D6 at LATB2_bit;
sbit LCD_D7 at LATB3_bit;
sbit LCD_RS_Direction at TRISD0_bit;
sbit LCD_EN_Direction at TRISD1_bit;
sbit LCD_D4_Direction at TRISB0_bit;
sbit LCD_D5_Direction at TRISB1_bit;
sbit LCD_D6_Direction at TRISB2_bit;
sbit LCD_D7_Direction at TRISB3_bit;
char text[60];
void main() {
ADPCFG = 0xFFFF; // Configure AN pins as digital
UART1_Init(19200); //Initialise UART and 19200 baud rate
delay_ms(100);
Lcd_Init(); //LCD Initialise
LCD_Cmd(_LCD_CURSOR_OFF); // send command to LCD (cursor off)
LCD_Cmd(_LCD_CLEAR); // send command to LCD (clear LCD)
do
{
if (UART1_Data_Ready()) { // if data is received
UART1_Read_Text(text, "s", 30); // reads text until 's' is found
Lcd_Out(1,1, text); //display on LCD
}
}while(1);
}