8.6 Input Mapping
The inputs of the Peripheral Pin Select options are mapped based on 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.
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
| RPINRx Value | dsPIC33CK256/128:Function | dsPIC33CK256/128:Available Ports | dsPIC33CK64/32:Function | dsPIC33CK64/32:Available Ports |
|---|---|---|---|---|
| 0 | VSS | Internal | VSS | Internal |
| 1 | Comparator 1 | Internal | Comparator 1 | Internal |
| 2 | Reserved | Reserved | Reserved | Reserved |
| 3 | Reserved | Reserved | Reserved | Reserved |
| 4-5 | Reserved | Reserved | Reserved | Reserved |
| 6 | PTG Trigger 26 | Internal | PTG Trigger 26 | Internal |
| 7 | PTG Trigger 27 | Internal | PTG Trigger 27 | Internal |
| 8-10 | Reserved | Reserved | Reserved | Reserved |
| 11 | PWM Event Out C | Internal | PWM Event Out C | Internal |
| 12 | PWM Event Out D | Internal | PWM Event Out D | Internal |
| 13 | PWM Event Out E | Internal | PWM Event Out E | Internal |
| 14-31 | Reserved | Reserved | Reserved | Reserved |
| 32 | RP32 | Port Pin RB0 | RP32 | Port Pin RB0 |
| 33 | RP33 | Port Pin RB1 | RP33 | Port Pin RB1 |
| 34 | RP34 | Port Pin RB2 | RP34 | Port Pin RB2 |
| 35 | RP35 | Port Pin RB3 | RP35 | Port Pin RB3 |
| 36 | RP36 | Port Pin RB4 | RP36 | Port Pin RB4 |
| 37 | RP37 | Port Pin RB5 | RP37 | Port Pin RB5 |
| 38 | RP38 | Port Pin RB6 | RP38 | Port Pin RB6 |
| 39 | RP39 | Port Pin RB7 | RP39 | Port Pin RB7 |
| 40 | RP40 | Port Pin RB8 | RP40 | Port Pin RB8 |
| 41 | RP41 | Port Pin RB9 | RP41 | Port Pin RB9 |
| 42 | RP42 | Port Pin RB10 | RP42 | Port Pin RB10 |
| 43 | RP43 | Port Pin RB11 | RP43 | Port Pin RB11 |
| 44 | RP44 | Port Pin RB12 | RP44 | Port Pin RB12 |
| 45 | RP45 | Port Pin RB13 | RP45 | Port Pin RB13 |
| 46 | RP46 | Port Pin RB14 | RP46 | Port Pin RB14 |
| 47 | RP47 | Port Pin RB15 | RP47 | Port Pin RB15 |
| 48 | RP48 | Port Pin RC0 | RP48 | Port Pin RC0 |
| 49 | RP49 | Port Pin RC1 | RP49 | Port Pin RC1 |
| 50 | RP50 | Port Pin RC2 | RP50 | Port Pin RC2 |
| 51 | RP51 | Port Pin RC3 | RP51 | Port Pin RC3 |
| 52 | RP52 | Port Pin RC4 | RP52 | Port Pin RC4 |
| 53 | RP53 | Port Pin RC5 | RP53 | Port Pin RC5 |
| 54 | RP54 | Port Pin RC6 | RP54 | Port Pin RC6 |
| 55 | RP55 | Port Pin RC7 | RP55 | Port Pin RC7 |
| 56 | RP56 | Port Pin RC8 | RP56 | Port Pin RC8 |
| 57 | RP57 | Port Pin RC9 | RP57 | Port Pin RC9 |
| 58 | RP58 | Port Pin RC10 | RP58 | Port Pin RC10 |
| 59 | RP59 | Port Pin RC11 | RP59 | Port Pin RC11 |
| 60 | RP60 | Port Pin RC12 | RP60 | Port Pin RC12 |
| 61 | RP61 | Port Pin RC13 | RP61 | Port Pin RC13 |
| 62 | RP62 | Port Pin RC14 | Reserved | Reserved |
| 63 | RP63 | Port Pin RC15 | Reserved | Reserved |
| 64 | RP64 | Port Pin RD0 | Reserved | Reserved |
| 65 | RP65 | Port Pin RD1 | RP65 | Port Pin RD1 |
| 66 | RP66 | Port Pin RD2 | Reserved | Reserved |
| 67 | RP67 | Port Pin RD3 | Reserved | Reserved |
| 68 | RP68 | Port Pin RD4 | Reserved | Reserved |
| 69 | RP69 | Port Pin RD5 | Reserved | Reserved |
| 70 | RP70 | Port Pin RD6 | Reserved | Reserved |
| 71 | RP71 | Port Pin RD7 | Reserved | Reserved |
| 72 | RP72 | Port Pin RD8 | RP72 | Port Pin RD8 |
| 73 | RP73 | Port Pin RD9 | Reserved | Reserved |
| 74 | RP74 | Port Pin RD10 | RP74 | Port Pin RD10 |
| 75 | RP75 | Port Pin RD11 | Reserved | Reserved |
| 76 | RP76 | Port Pin RD12 | Reserved | Reserved |
| 77 | RP77 | Port Pin RD13 | RP77 | Port Pin RD13 |
| 78 | RP78 | Port Pin RD14 | Reserved | Reserved |
| 79 | RP79 | Port Pin RD15 | Reserved | Reserved |
| 80-165 | Reserved | Reserved | Reserved | Reserved |
| 166 | Reserved | Reserved | Reserved | Reserved |
| 167 | Reserved | Reserved | Reserved | Reserved |
| 168 | DAC1 pwm_req_on | Internal | DAC1 pwm_req_on | Internal |
| 169 | DAC1 pwm_req_off | Internal | DAC1 pwm_req_off | Internal |
| 170-175 | Reserved | Reserved | Reserved | Reserved |
| 176 | RP176 | Virtual RPV0 | RP176 | Virtual RPV0 |
| 177 | RP177 | Virtual RPV1 | RP177 | Virtual RPV1 |
| 178 | RP178 | Virtual RPV2 | RP178 | Virtual RPV2 |
| 179 | RP179 | Virtual RPV3 | RP179 | Virtual RPV3 |
| 180 | RP180 | Virtual RPV4 | RP180 | Virtual RPV4 |
| 181 | RP181 | Virtual RPV5 | RP181 | Virtual RPV5 |
| Input Name(1) | Function Name | Register | Register Bits |
|---|---|---|---|
| External Interrupt 1 | INT1 | RPINR0 | INT1R[7:0] |
| External Interrupt 2 | INT2 | RPINR1 | INT2R[7:0] |
| External Interrupt 3 | INT3 | RPINR1 | INT3R[7:0] |
| Timer1 External Clock | T1CK | RPINR2 | T1CK[7:0] |
| SCCP Timer1 | TCKI1 | RPINR3 | TCKI1R[7:0] |
| SCCP Capture 1 | ICM1 | RPINR3 | ICM1R[7:0] |
| SCCP Timer2 | TCKI2 | RPINR4 | TCKI2R[7:0] |
| SCCP Capture 2 | ICM2 | RPINR4 | ICM2R[7:0] |
| SCCP Timer3 | TCKI3 | RPINR5 | TCKI3R[7:0] |
| SCCP Capture 3 | ICM3 | RPINR5 | ICM3R[7:0] |
| SCCP Timer4 | TCKI4 | RPINR6 | TCKI4R[7:0] |
| SCCP Capture 4 | ICM4 | RPINR6 | ICM4R[7:0] |
| SCCP Fault A | OCFA | RPINR11 | OCFAR[7:0] |
| SCCP Fault B | OCFB | RPINR11 | OCFBR[7:0] |
| PWM PCI Input 8 | PCI8 | RPINR12 | PCI8R[7:0] |
| PWM PCI Input 9 | PCI9 | RPINR12 | PCI9R[7:0] |
| PWM PCI Input 10 | PCI10 | RPINR13 | PCI10R[7:0] |
| PWM PCI Input 11 | PCI11 | RPINR13 | PCI11R[7:0] |
| UART1 Receive | U1RX | RPINR18 | U1RXR[7:0] |
| UART1 Data-Set-Ready | U1DSR | RPINR18 | U1DSRR[7:0] |
| UART2 Receive | U2RX | RPINR19 | U2RXR[7:0] |
| UART2 Data-Set-Ready | U2DSR | RPINR19 | U2DSRR[7:0] |
| SPI1 Data Input | SDI1 | RPINR20 | SDI1R[7:0] |
| SPI1 Clock Input | SCK1IN | RPINR20 | SCK1R[7:0] |
| SPI1 Client Select | SS1 | RPINR21 | SS1R[7:0] |
| Reference Clock Input | REFCLKI | RPINR21 | REFOIR[7:0] |
| SPI2 Data Input | SDI2 | RPINR22 | SDI2R[7:0] |
| SPI2 Clock Input | SCK2IN | RPINR22 | SCK2R[7:0] |
| SPI2 Client Select | SS2 | RPINR23 | SS2R[7:0] |
| CAN1 Input (CAN1RX) | CAN1RX | RPINR26 | CAN1RXR[7:0] |
| UART3 Receive | U3RX | RPINR27 | U3RXR[7:0] |
| UART3 Data-Set-Ready | U3DSR | RPINR27 | U3DSRR[7:0] |
| SCCP Fault C | OCFC | RPINR37 | OCFCR[7:0] |
| PWM PCI Input 17 | PCI17 | RPINR37 | PCI17R[7:0] |
| PWM PCI Input 18 | PCI18 | RPINR38 | PCI18R[7:0] |
| PWM PCI Input 12 | PCI12 | RPINR42 | PCI12R[7:0] |
| PWM PCI Input 13 | PCI13 | RPINR42 | PCI13R[7:0] |
| PWM PCI Input 14 | PCI14 | RPINR43 | PCI14R[7:0] |
| PWM PCI Input 15 | PCI15 | RPINR43 | PCI15R[7:0] |
| PWM PCI Input 16 | PCI16 | RPINR44 | PCI16R[7:0] |
| SENT1 Input | SENT1 | RPINR44 | SENT1R[7:0] |
| CLC Input A | CLCINA | RPINR45 | CLCINAR[7:0] |
| CLC Input B | CLCINB | RPINR46 | CLCINBR[7:0] |
| CLC Input C | CLCINC | RPINR46 | CLCINCR[7:0] |
| CLC Input D | CLCIND | RPINR47 | CLCINDR[7:0] |
| ADC Trigger Input (ADTRIG31) | ADCTRG | RPINR47 | ADCTRGR[7:0] |
| SCCP Fault D | OCFD | RPINR48 | OCFDR[7:0] |
| UART1 Clear-to-Send | U1CTS | RPINR48 | U1CTSR[7:0] |
| UART2 Clear-to-Send | U2CTS | RPINR49 | U2CTSR[7:0] |
| UART3 Clear-to-Send | U3CTS | RPINR49 | U3CTSR[7:0] |
|
Note:
| |||
Configuring UART1 Input and Output Functions
//
*******************************************
// Unlock Registers
//*****************************************
__builtin_write_RPCON(0x0000);
//*****************************************
// Configure Input Functions (See Table 3-32)
// Assign U1Rx To Pin RP35
//***************************
_U1RXR = 35;
// Assign U1CTS To Pin RP36
//***************************
_U1CTSR = 36;
//*****************************************
// Configure Output Functions (See Table 3-34)
//*****************************************
// Assign U1Tx To Pin RP37
//***************************
_RP37R = 1;
//***************************
// Assign U1RTS To Pin RP38
//***************************
_RP38R = 2;
//*****************************************
// Lock Registers
//*****************************************
__builtin_write_RPCON(0x0800);
