//Set RPB9 as UART2 TX

ANSELBbits.ANSB9=0;         // RPB9 as digital I/O
TRISBbits.TRISB9=0 ;        // RPB9 as output
RPB9R = 2;                 // RPB9 as U2TX