//*************************************************************
// Unlock Registers
//*************************************************************
__builtin_write_OSCCONL(OSCCON & 0xbf) //clear the bit 6 of OSCCONL to
//unlock Pin Re-map
//******************************************************************
//This code is used when interested in inline assembly. If this code is //
used then the above two lines should not be used for unlocking.
//******************************************************************
/*
asm volatile ( “push w1 \n”
“push w2 \n”
“push w3 \n”
"mov #OSCCON, w1 \n"
"mov #0x46, w2 \n"
"mov #0x57, w3 \n"
"mov.b w2, [w1] \n"
"mov.b w3, [w1] \n"
"bclr OSCCON, #6 \n"
“pop w3 \n”
“pop w2 \n”
“pop w1”);
*/
//************************************************************
// Configure Input Functions
//************************************************************
//***************************
// Assign U1Rx To Pin RP0
//***************************
RPINR18bits.U1RXR = 0; //’0’ represents RP0
//***************************
// Assign U1CTS To Pin RP1
//***************************
RPINR18bits.U1CTSR = 1; //’1’ represents RP1
//************************************************************
// Configure Output Functions
//************************************************************
//***************************
// Assign U1Tx To Pin RP2
//***************************
RPOR1bits.RP2R = 3; //’3’ represents U1TX
//***************************
// Assign U1RTS To Pin RP3
//***************************
RPOR1bits.RP3R = 4; //’4’ represents U1RTS
//************************************************************
// Lock Registers
//************************************************************
__builtin_write_OSCCONL(OSCCON | 0x40) //set the bit 6 of OSCCONL to
//lock Pin Re-map
//******************************************************************
//This code is used when interested in inline assembly. If this code is //
used then the above two lines should not be used for unlocking.
//******************************************************************
/*
asm volatile ( “push w1 \n”
“push w2 \n”
“push w3 \n”
"mov #OSCCON, w1 \n"
"mov #0x46, w2 \n"
"mov #0x57, w3 \n"
"mov.b w2, [w1] \n"
"mov.b w3, [w1] \n"
"bset OSCCON, #6 \n"
“pop w3 \n”
“pop w2 \n”
“pop w1”;
*/