void main()
{
unsigned short i;
TRISB = 0; // PORTB is output
Lcd_Init(&PORTB); // Initialize LCD connected to PORTB
Lcd_Cmd(Lcd_CLEAR); // Clear display
Lcd_Cmd(Lcd_CURSOR_OFF); // Turn cursor off
Lcd_Out(1, 1, "HI"); // Print text to LCD, 2nd row, 1st column
Usart_Init(9600);
Delay_ms(100);
Usart_Write('p');
Delay_ms(100);
do
{
if (Usart_Data_Ready()) // If data is received
{
i = Usart_Read(); // Read the received data
Usart_Write(i); // Send data via USART
Lcd_Chr(2,1,i+48);
}
} while (1);
}