TRISCbits.TRSC9 = 1 ;   // Ensure RPC9 is an input pin
QEA2Rbits.QEA2R = 5;    // RPC9 as QEA input

ANSELEbits.ANSE14 = 0;  // RPE14 as digital port.
TRISEbits.TRSE14 = 1;   // Esnure RPE14 is an input pin
QEB2Rbits.QEB2R = 8;    // RPE14 as QEB input