Peripheral Pin Select Library
Peripheral Pin Select Library allows remapping of peripherals on the MCU's that have Peripheral Pin Select module implemented.
A key difference between pin select and non-pin select peripherals is that pin select peripherals are not associated with a default I/O pin.
The peripheral must always be assigned to a specific I/O pin before it can be used.
In contrast, non pin selectable peripherals are always available on a default pin, assuming that the peripheral is active and not conflicting with another peripheral.
This library covers also Peripheral Pin Select Lite module available with the PIC18FxxJ94 devices.
Library Routines
Unlock_IOLOCK
Prototype |
void Unlock_IOLOCK(); |
---|---|
Returns |
Nothing. |
Description |
Unlocks I/O pins for Peripheral Pin Mapping. |
Requires |
Nothing. |
Example |
Unlock_IOLOCK(); |
Lock_IOLOCK
Prototype |
void Lock_IOLOCK(); |
---|---|
Returns |
Nothing. |
Description |
Locks I/O pins for Peripheral Pin Mapping. |
Requires |
Nothing. |
Example |
Lock_IOLOCK(); |
PPS_Mapping
Prototype |
char PPS_Mapping(char rp_num, char input_output, char funct_name); |
---|---|
Returns |
|
Description |
Sets desired internal MCU module to be mapped with the requested pins. Parameters :
|
Requires |
Nothing. |
Example |
PPS_Mapping(15, _INPUT, _RX2_DT2); // Sets pin 15 to be Input, and maps RX2/DT2 Input to it PPS_Mapping(5, _OUTPUT, _TX2_CK2); // Sets pin 5 to be Output, and maps EUSART2 Asynchronous Transmit/Synchronous Clock Output to it |
PPS_Mapping_NoLock
Prototype |
char PPS_Mapping_NoLock(char rp_num, char input_output, char funct_name); |
---|---|
Returns |
|
Description |
Sets desired internal MCU module to be mapped on the requested pins. This function doesn't use Unlock_IOLOCK and Lock_IOLOCK routines, so the user must call them before and after this function call (very useful if Parameters :
|
Parameters | |
Requires |
Nothing. |
Example |
Unlock_IOLOCK(); PPS_Mapping_NoLock(15, _INPUT, _RX2_DT2); // Sets pin 15 to be Input, and maps RX2/DT2 Input to it PPS_Mapping_NoLock(5, _OUTPUT, _TX2_CK2); // Sets pin 5 to be Output, and maps EUSART2 Asynchronous Transmit/Synchronous Clock Output to it Lock_IOLOCK(); |
Available Parameters
PPS Mapping Parameters
Function Name (Input) | Description |
---|---|
_INT1 | External Interrupt 1 |
_INT2 | External Interrupt 2 |
_INT3 | External Interrupt 3 |
_T0CKI | Timer0 External Clock Input |
_T3CKI | Timer3 External Clock Input |
_CCP1 | Input Capture 1 |
_CCP2 | Input Capture 2 |
_T1G | Timer1 Gate Input |
_T3G | Timer3 Gate Input |
_RX2_DT2 | RX2/DT2 Input |
_CK2 | EUSART2 Synchronous Clock Input |
_SDI2 | SPI2 Data Input |
_SCK2IN | SPI2 Clock Input |
_SS2IN | SPI2 Slave Select Input |
_FLT0 | PWM Fault Input |
_INTPPS | PWM Fault Input |
_INTPPS | PWM Fault Input |
_T1CKIPPS | PWM Fault Input |
_T1GPPS | PWM Fault Input |
_CCP1PPS | PWM Fault Input |
_CCP2PPS | PWM Fault Input |
_COGINPPS | PWM Fault Input |
_SSPCLKPPS | PWM Fault Input |
_SSPDATPPS | PWM Fault Input |
_SSPSSPPS | PWM Fault Input |
_RXPPS | PWM Fault Input |
_CKPPS | PWM Fault Input |
_CLCIN0PPS | PWM Fault Input |
_CLCIN1PPS | PWM Fault Input |
_CLCIN2PPS | PWM Fault Input |
_CLCIN3PPS | PWM Fault Input |
_CAN_RX | CAN Rx Input |
_RA0 | Pin Input |
_RA1 | Pin Input |
_RA2 | Pin Input |
_RA3 | Pin Input |
_RA4 | Pin Input |
_RA5 | Pin Input |
_RA6 | Pin Input |
_RA7 | Pin Input |
_RB0 | Pin Input |
_RB1 | Pin Input |
_RB2 | Pin Input |
_RB3 | Pin Input |
_RB4 | Pin Input |
_RB5 | Pin Input |
_RB6 | Pin Input |
_RB7 | Pin Input |
_RC0 | Pin Input |
_RC1 | Pin Input |
_RC2 | Pin Input |
_RC3 | Pin Input |
_RC4 | Pin Input |
_RC5 | Pin Input |
_RC6 | Pin Input |
_RC7 | Pin Input |
_RD0 | Pin Input |
_RD1 | Pin Input |
_RD2 | Pin Input |
_RD3 | Pin Input |
_RD4 | Pin Input |
_RD5 | Pin Input |
_RD6 | Pin Input |
_RD7 | Pin Input |
_RE0 | Pin Input |
_RE1 | Pin Input |
_RE2 | Pin Input |
Function Name (Output) | Description |
_NULL | The NULL function is assigned to all RPn outputs at device Reset and disables the RPn output function. |
_C1OUT | Comparator 1 Output |
_C2OUT | Comparator 2 Output |
_TX2_CK2 | EUSART Asynchronous Transmit/Synchronous Clock Output |
_TX2_CK2 | EUSART2 Asynchronous Transmit/Synchronous Clock Output |
_DT | EUSART Synchronous Transmit |
_DT2 | EUSART2 Synchronous Transmit |
_SDO | SPI Data Output |
_SDA | I2C Data Output |
_SCK_SCL | SPI/I2C Clock Output |
_SDO2 | SPI2 Data Output |
_SCK2 | SPI2 Clock Output |
_SSDMA | SPI DMA Slave Select |
_ULPOUT | Ultra Low-Power Wake-up Event |
_CCP1 | CCP1 Compare or PWM Output |
_CCP1_P1A | ECCP1 Compare or PWM Output Channel A |
_P1B | ECCP1 Enhanced PWM Output, Channel B |
_P1C | ECCP1 Enhanced PWM Output, Channel C |
_P1D | ECCP1 Enhanced PWM Output, Channel D |
_CCP2 | CCP2 Compare or PWM Output |
_CCP2_P2A | ECCP2 Compare or PWM Output |
_P2B | ECCP2 Enhanced PWM Output, Channel B |
_P2C | ECCP2 Enhanced PWM Output, Channel C |
_P2D | ECCP2 Enhanced PWM Output, Channel D |
_PWM3OUT | PWM3 Output |
_PWM4OUT | PWM4 Output |
_CLC1OUT | Configurable Logic Cell 1 Output |
_CLC2OUT | Configurable Logic Cell 2 Output |
_CLC3OUT | Configurable Logic Cell 3 Output |
_CLC4OUT | Configurable Logic Cell 4 Output |
_COG1A | Complementary Output Generator Output A |
_COG1B | Complementary Output Generator Output B |
_COG1C | Complementary Output Generator Output C |
_COG1D | Complementary Output Generator Output D |
_NCO1OUT | Numerically Controlled Oscillator Output. |
_CANTX0 | CAN0 Tx Output |
_CANTX1 | CAN1 Tx Output |
_LATxy | Default value on reset - no mapping. |
Input/Output Parameter | Description |
_INPUT | Sets selected pin as input |
_OUTPUT | Sets selected pin as output |
PPS Mapping Lite Parameters
Function Name (Input) | Description |
---|---|
_INT1 | External Interrupt 1 |
_INT2 | External Interrupt 2 |
_INT3 | External Interrupt 3 |
_T0CKI | Timer0 External Clock Input |
_T1CKI | Timer1 External Clock Input |
_T3CKI | Timer3 External Clock Input |
_T5CKI | Timer5 External Clock Input |
_ECCP1 | Input Capture 1 |
_ECCP2 | Input Capture 2 |
_ECCP3 | Input Capture 3 |
_ECCP3 | Input Capture 3 |
_CCP4_IN | Input Capture 4 |
_CCP5_IN | Input Capture 5 |
_CCP6_IN | Input Capture 6 |
_CCP7_IN | Input Capture 7 |
_CCP8_IN | Input Capture 8 |
_CCP9_IN | Input Capture 9 |
_CCP10_IN | Input Capture 10 |
_T1G | Timer1 Gate Input |
_T3G | Timer3 Gate Input |
_T5G | Timer5 Gate Input |
_SCK1_IN | SPI1 Clock Input |
_SDI1 | SPI1 Data Input |
_SS1 | SPI1 Slave Select Input |
_SCK2_IN | SPI2 Clock Input |
_SDI2 | SPI2 Data Input |
_SS2 | SPI2 Slave Select Input |
_FLT0 | PWM Fault Input |
_U1RX | UART1 Input |
_U1TX | UART1 Output |
_U2RX | UART2 Input |
_U2TX | UART2 Output |
_U3RX | UART3 Input |
_U3TX | UART3 Output |
_U4RX | UART4 Input |
_U4TX | UART4 Output |
_IOC0 | Interrupt On Change 0 Input |
_IOC1 | Interrupt On Change 1 Input |
_IOC2 | Interrupt On Change 2 Input |
_IOC3 | Interrupt On Change 3 Input |
_IOC4 | Interrupt On Change 4 Input |
_IOC5 | Interrupt On Change 5 Input |
_IOC6 | Interrupt On Change 6 Input |
_IOC7 | Interrupt On Change 7 Input |
Function Name (Output) | Description |
_NULL | The NULL function is assigned to all RPn outputs at device Reset and disables the RPn output function. |
_C1OUT | Comparator 1 Output |
_C2OUT | Comparator 2 Output |
_C3OUT | Comparator 3 Output |
_U1TX_CK | EUSART1 Asynchronous Transmit/Synchronous Clock Output |
_U1RX_DT | EUSART1 |
_U2TX_CK | EUSART1 Asynchronous Transmit/Synchronous Clock Output |
_U2RX_DT | EUSART1 RX/DT Output |
_U3TX_CK | EUSART1 Asynchronous Transmit/Synchronous Clock Output |
_U3RX_DT | EUSART1 RX/DT Output |
_U4TX_CK | EUSART1 Asynchronous Transmit/Synchronous Clock Output |
_U4RX_DT | EUSART1 RX/DT Output |
_SDO1 | SPI1 Data Output |
_SCK1 | SPI1 Clock Output |
_SDO2 | SPI2 Data Output |
_SCK2 | SPI2 Clock Output |
_CCP1_P1A | ECCP1 Compare or PWM Output Channel A |
_P1B | ECCP1 Enhanced PWM Output, Channel B |
_P1C | ECCP1 Enhanced PWM Output, Channel C |
_P1D | ECCP1 Enhanced PWM Output, Channel D |
_CCP2_P2A | ECCP2 Compare or PWM Output, Channel A |
_P2B | ECCP2 Enhanced PWM Output, Channel B |
_P2C | ECCP2 Enhanced PWM Output, Channel C |
_P2D | ECCP2 Enhanced PWM Output, Channel D |
_CCP3_P3A | ECCP3 Compare or PWM Output, Channel A |
_P3B | ECCP3 Enhanced PWM Output, Channel B |
_P3C | ECCP3 Enhanced PWM Output, Channel C |
_P3D | ECCP3 Enhanced PWM Output, Channel D |
_CCP4 | CCP4 Module Output |
_CCP5 | CCP5 Module Output |
_CCP6 | CCP6 Module Output |
_CCP7 | CCP7 Module Output |
_CCP8 | CCP8 Module Output |
_CCP9 | CCP9 Module Output |
_CCP10 | CCP10 Module Output |
_U1BCLK | UART1 Baud Rate Clock |
_U2BCLK | UART2 Baud Rate Clock |
_U3BCLK | UART3 Baud Rate Clock |
_U4BCLK | UART4 Baud Rate Clock |
_MDOUT | Modulator Output |
_CTPLS | CTPLS Output |
Input/Output Parameter | Description |
_INPUT | Sets selected pin as input |
_OUTPUT | Sets selected pin as output |
What do you think about this topic ? Send us feedback!