8.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 8-3 for a list of available inputs.

For example, Figure 8-2 illustrates remappable pin selection for the U1RX input.
Figure 8-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 8-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
8APWM Event Out AInternal
9APWM Event Out BInternal
10APWM Event Out CInternal
11PWM Event Out CInternal
12PWM Event Out DInternal
13PWM Event Out EInternal
14RP14Reserved
15Comparator 6Internal
16-31RP16-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
52RP52Port Pin RC4
53RP53Port Pin RC5
54RP54Port Pin RC6
55RP55Port Pin RC7
56RP56Port Pin RC8
57RP57Port Pin RC9
58RP58Port Pin RC10
59RP59Port Pin RC11
60RP60Port Pin RC12
61RP61Port Pin RC13
62RP62Port Pin RC14
63RP63Port Pin RC15
64RP64Port Pin RD0
65RP65Port Pin RD1
66RP66Port Pin RD2
67RP67Port Pin RD3
68RP68Port Pin RD4
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
80RP80Port Pin RF0
81RP81Port Pin RF1
82RP82Port Pin RF2
83RP83Port Pin RF3
84RP84Port Pin RF4
85RP85Port Pin RF5
86RP86Port Pin RF6
87RP87Port Pin RF7
88RP88Port Pin RF8
89RP89Port Pin RF9
90RP90Port Pin RF10
91RP91Port Pin RF11
92RP92Port Pin RF12
93RP93Port Pin RF13
94RP94Port Pin RF14
95RP95Port Pin RF15
96RP96Port Pin RA5
97RP97Port Pin RA6
98RP98Port Pin RA7
99RP99Port Pin RA8
100-157RP100-RP157Reserved
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
170-175RP170-RP175Reserved
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 8-3)
// Assign U1Rx To Pin RP35
//***************************
_U1RXR = 35;
// Assign U1CTS To Pin RP36
//***************************
_U1CTSR = 36;
//*****************************************
// Configure Output Functions (See Table 8-6)
//*****************************************
// Assign U1Tx To Pin RP37
//***************************
_RP37 = 1;
//***************************
// Assign U1RTS To Pin RP38
//***************************
_RP38 = 2;
//*****************************************
// Lock Registers
//*****************************************
__builtin_write_RPCON(0x0800);