9.6 Input Mapping

The inputs of the Peripheral Pin Select options are mapped on the basis of the peripheral. That is, a control register associated with a peripheral dictates the pin it will be mapped to. The RPINRx registers are used to configure peripheral input mapping. Each register contains sets of 8-bit fields, with each set associated with one of the remappable peripherals. Programming a given peripheral’s bit field with an appropriate 8-bit index value maps the RPn pin with the corresponding value, or internal signal, to that peripheral. See Table 9-3 for a list of available inputs.

For example, Figure 9-2 illustrates remappable pin selection for the U1RX input.
Figure 9-2. Remappable Input for U1RX

Configuring UART1 Input and Output Functions provides a configuration for bidirectional communication with flow control using UART1. The following input and output functions are used:

  • Input Functions: U1RX, U1CTS
  • Output Functions: U1TX, U1RTS
Table 9-3. Remappable Pin Inputs
RPINRx[15:8] or RPINRx[7:0]FunctionAvailable on Ports
0VSSInternal
1Comparator 1Internal
2Comparator 2Internal
3Comparator 3Internal
4-5RP4-RP5Reserved
6PTG Trigger 26Internal
7PTG Trigger 27Internal
8-10RP8-RP10Reserved
11PWM Event Out CInternal
12PWM Event Out DInternal
13PWM Event Out EInternal
14-31RP14-RP31Reserved
32RP32Port Pin RB0
33RP33Port Pin RB1
34RP34Port Pin RB2
35RP35Port Pin RB3
36RP36Port Pin RB4
37RP37Port Pin RB5
38RP38Port Pin RB6
39RP39Port Pin RB7
40RP40Port Pin RB8
41RP41Port Pin RB9
42RP42Port Pin RB10
43RP43Port Pin RB11
44RP44Port Pin RB12
45RP45Port Pin RB13
46RP46Port Pin RB14
47RP47Port Pin RB15
48RP48Port Pin RC0
49RP49Port Pin RC1
50RP50Port Pin RC2
51RP51Port Pin RC3
52-53RP52-RP53Reserved
54RP54Port Pin RC6
55RP55Port Pin RC7
56RP56Port Pin RC8
57RP57Port Pin RC9
58-59RP58-RP59Reserved
60RP60Port Pin RC12
61RP61Port Pin RC13
62RP62Port Pin RC14
63RP63Port Pin RC15
64RP64Port Pin RD0
65RP65Port Pin RD1
66RP66Port Pin RD2
67-68RP67-RP68Reserved
69RP69Port Pin RD5
70RP70Port Pin RD6
71RP71Port Pin RD7
72RP72Port Pin RD8
73RP73Port Pin RD9
74RP74Port Pin RD10
75RP75Port Pin RD11
76RP76Port Pin RD12
77RP77Port Pin RD13
78RP78Port Pin RD14
79RP79Port Pin RD15
80-157RP80-RP175Reserved
158DAC6 pwm_req_onInternal
159DAC6 pwm_req_offInternal
160DAC5 pwm_req_onInternal
161DAC5 pwm_req_offInternal
162DAC4 pwm_req_onInternal
163DAC4 pwm_req_offInternal
164DAC3 pwm_req_onInternal
165DAC3 pwm_req_offInternal
166DAC2 pwm_req_onInternal
167DAC2 pwm_req_offInternal
168DAC1 pwm_req_onInternal
169DAC1 pwm_req_offInternal
176RP176Virtual RPV0
177RP177Virtual RPV1
178RP178Virtual RPV2
179RP179Virtual RPV3
180RP180Virtual RPV4
181RP181Virtual RPV5

Configuring UART1 Input and Output Functions

//
*******************************************
// Unlock Registers
//*****************************************
__builtin_write_RPCON(0x0000);
//*****************************************
// Configure Input Functions (See Table 9-3)
// Assign U1Rx To Pin RP35
//***************************
_U1RXR = 35;
// Assign U1CTS To Pin RP36
//***************************
_U1CTSR = 36;
//*****************************************
// Configure Output Functions (See Table 9-6)
//*****************************************
// Assign U1Tx To Pin RP37
//***************************
_RP37 = 1;
//***************************
// Assign U1RTS To Pin RP38
//***************************
_RP38 = 2;
//*****************************************
// Lock Registers
//*****************************************
__builtin_write_RPCON(0x0800);