RPINR18bits.U1RXR = 9; // Make Pin RP9 U1RX
RPOR4bits.RP8R = 3; // Make Pin RP8 U1TX
PADCFG1 = 0xFF; // Make analog pins digital
LATB = 0x0;
TRISB = 0x0FFF; // Configure LED pins as output
TMR1 = 0; // Clear timer 1
PR1 = 0x3D09; // Interrupt every 250ms
IFS0bits.T1IF = 0; // Clear interrupt flag
IEC0bits.T1IE = 1; // Set interrupt enable bit
T1CON = 0x8030; // Fosc/4, 1:256 prescale, start TMR1
TRISB = 0x0300;
U1BRG = BRGVAL;
U1MODE = 0x8000; // Reset UART to 8-n-1, alt pins, and enable
U1STA = 0x0440; // Reset status register and enable TX & RX
_U1RXIF=0; // Clear UART RX Interrupt Flag