PIE1bits.RC1IE = 1;
INTCON |= 0xC0; // Set GIE, PEIE
#pragma interrupt InterruptHandlerHigh
void InterruptHandlerHigh ()
{
if(PIR1bits.RC1IF) // if a RX interrupt occured
{
PIE1bits.RC1IE = 0; // Disable serial interrupt for manual reading (optional , you can go with complete INT based reading)
*uart_buf = RCREG1; // Read first byte (pointing to an array)
while((*uart_buf!=0x0D)) // Read data untill 'enter' key is pressed (this is in my case & you can use any other option)
{
uart_buf++;
while(!USART1_DataRdy());
*uart_buf = USART1_Read();
}
*uart_buf = '\0'; // Write null at the end of the string
PIE1bits.RC1IE = 1; // Enable serial interrupt
}