Go to the source code of this file.
Defines | |
Low-level port configuration macros | |
These macros support low-level pin configuration in the following areas:
| |
#define | ENABLE_Rxy_ANALOG() _PCFGn = 0 |
#define | DISABLE_Rxy_ANALOG() _PCFGn = 1 |
#define | CONFIG_RPy_AS_DIG_PIN() _PCFG = 1 |
#define | ENABLE_Rxy_OPENDRAIN() _ODCxy = 1 |
#define | DISABLE_Rxy_OPENDRAIN() _ODCxy = 0 |
#define | ENABLE_Rxy_PULLUP() _CNmPUE = 1 |
#define | DISABLE_Rxy_PULLUP() _CNmPUE = 1 |
#define | ENABLE_Rxy_CN_INTERRUPT() _CNmIE = 1 |
#define | DISABLE_Rxy_CN_INTERRUPT() _CNmIE = 0 |
Remappable peripheral input support | |
#define | CONFIG_INT1_TO_RP(pin) _INT1R = pin |
See CONFIG_xxx_TO_RP(pin) for more information. | |
#define | CONFIG_INT2_TO_RP(pin) _INT2R = pin |
#define | CONFIG_T2CK_TO_RP(pin) _T2CKR = pin |
#define | CONFIG_T3CK_TO_RP(pin) _T3CKR = pin |
#define | CONFIG_T4CK_TO_RP(pin) _T4CKR = pin |
#define | CONFIG_T5CK_TO_RP(pin) _T5CKR = pin |
#define | CONFIG_IC1_TO_RP(pin) _IC1R = pin |
#define | CONFIG_IC2_TO_RP(pin) _IC2R = pin |
#define | CONFIG_IC3_TO_RP(pin) _IC3R = pin |
#define | CONFIG_IC4_TO_RP(pin) _IC4R = pin |
#define | CONFIG_IC5_TO_RP(pin) _IC5R = pin |
#define | CONFIG_IC6_TO_RP(pin) _IC6R = pin |
#define | CONFIG_IC7_TO_RP(pin) _IC7R = pin |
#define | CONFIG_IC8_TO_RP(pin) _IC8R = pin |
#define | CONFIG_OCFA_TO_RP(pin) _OCFAR = pin |
#define | CONFIG_OCFB_TO_RP(pin) _OCFBR = pin |
#define | CONFIG_U1RX_TO_RP(pin) _U1RXR = pin |
#define | CONFIG_U1CTS_TO_RP(pin) _U1CTSR = pin |
#define | CONFIG_U2RX_TO_RP(pin) _U2RXR = pin |
#define | CONFIG_U2CTS_TO_RP(pin) _U2CTSR = pin |
#define | CONFIG_SDI1_TO_RP(pin) _SDI1R = pin |
#define | CONFIG_SCK1IN_TO_RP(pin) _SCK1R = pin |
#define | CONFIG_SS1IN_TO_RP(pin) _SS1R = pin |
#define | CONFIG_SDI2_TO_RP(pin) _SDI2R = pin |
#define | CONFIG_SCK2IN_TO_RP(pin) _SCK2R = pin |
#define | CONFIG_SS2IN_TO_RP(pin) _SS2R = pin |
#define | CONFIG_C1RXR_TO_RP(pin) _C1RXR = pin |
#define | CONFIG_C2RXR_TO_RP(pin) _C2RXR = pin |
Remappable peripheral output support | |
#define | CONFIG_yyy_TO_RP(pin) _RP##pin##R = z |
#define | CONFIG_C1OUT_TO_RP(pin) _RP##pin##R = 1 |
#define | CONFIG_C2OUT_TO_RP(pin) _RP##pin##R = 2 |
#define | CONFIG_U1TX_TO_RP(pin) _RP##pin##R = 3 |
#define | CONFIG_U1RTS_TO_RP(pin) _RP##pin##R = 4 |
#define | CONFIG_U2TX_TO_RP(pin) _RP##pin##R = 5 |
#define | CONFIG_U2RTS_TO_RP(pin) _RP##pin##R = 6 |
#define | CONFIG_SDO1_TO_RP(pin) _RP##pin##R = 7 |
#define | CONFIG_SCK1OUT_TO_RP(pin) _RP##pin##R = 8 |
#define | CONFIG_SS1OUT_TO_RP(pin) _RP##pin##R = 9 |
#define | CONFIG_SDO2_TO_RP(pin) _RP##pin##R = 10 |
#define | CONFIG_SCK2OUT_TO_RP(pin) _RP##pin##R = 11 |
#define | CONFIG_SS2OUT_TO_RP(pin) _RP##pin##R = 12 |
#define | CONFIG_C1TX_TO_RP(pin) _RP##pin##R = 16 |
#define | CONFIG_OC1_TO_RP(pin) _RP##pin##R = 18 |
#define | CONFIG_OC2_TO_RP(pin) _RP##pin##R = 19 |
#define | CONFIG_OC3_TO_RP(pin) _RP##pin##R = 20 |
#define | CONFIG_OC4_TO_RP(pin) _RP##pin##R = 21 |
#define | CONFIG_OC5_TO_RP(pin) _RP##pin##R = 22 |
Functions | |
High-level port configuration | |
These macros choose digital or analog, input or output, open-drain or standard. Use the low-level ENABLE/DISABLE_Rxy_PULLUP() to configure the pullup. | |
static void | CONFIG_Rxy_AS_DIG_OUTPUT () |
static void | CONFIG_Rxy_AS_DIG_OD_OUTPUT () |
static void | CONFIG_Rxy_AS_DIG_INPUT () |
static void | CONFIG_ANx_AS_ANALOG () |
To reduce the confusing variety of naming schemes for these bits, the macros refer to a pin either by its port letter x plus pin number y (for example, _TRISB3 for the TRIS bit of port B, pin 3) or by the analog input number n (for example, AN0 refers to analog input 0).
The macros provided as "smart" - only functions applicable to that pin are contained in a given macro. For example, CONFIG_RA1_AS_DIG_OUTPUT on the PIC24HJ32GP202 disables the pin's pullup, disables the open-drain driver, disables analog functionality, then sets the pin as an output. CONFIG_RA7_AS_DIG_OUTPUT on the PIC24HJ32GP204 only disables the open-drain driver and sets the pin as an output, because that pin supports neither analog nor pullup functionality.
Definition in file pic24_ports.h.
#define CONFIG_C1OUT_TO_RP | ( | pin | ) | _RP##pin##R = 1 |
Maps C1OUT to a remappable pin; see CONFIG_yyy_TO_RP(pin) for more informatino.
Definition at line 399 of file pic24_ports.h.
#define CONFIG_INT1_TO_RP | ( | pin | ) | _INT1R = pin |
See CONFIG_xxx_TO_RP(pin) for more information.
These funcions map an input internal to the PIC to an input pin. For example, CONFIG_INT1_TO_RP(10) maps the INT1 edge-triggered interrupt to port P, pin 10.
Not all devices support remappable peripherals. In these cases, the macros below evalaute to nothing: CONFIG_INT1_TO_RP(10) is a valid C statement which does nothing. Maps INT1 to a remappable pin; see CONFIG_xxx_TO_RP(pin) for more informatino.
Definition at line 208 of file pic24_ports.h.
#define CONFIG_RPy_AS_DIG_PIN | ( | ) | _PCFG = 1 |
Makes port P, pin y a digital pin by disabling analog functionality on that pin. This is done by setting the corresponding _PCFGn bit. For example, CONFIG_RP10_AS_DIG_PIN() makes port P, pin 10 a digital pin by disabling analog its functionality.
Definition at line 155 of file pic24_ports.h.
#define CONFIG_yyy_TO_RP | ( | pin | ) | _RP##pin##R = z |
These functions maps an output internal to the PIC to an output pin. For example, CONFIG_C1OUT_TO_RP(10) maps the C1OUT comparator output to port P, pin 10.
Not all devices support remappable peripherals. In these cases, the macros below evalaute to nothing: CONFIG_C1OUT_TO_RP(10) is a valid C statement which does nothing.
Definition at line 393 of file pic24_ports.h.
#define DISABLE_Rxy_ANALOG | ( | ) | _PCFGn = 1 |
Disables analog functionality on port x of pin y by setting the corresponding _PCFGn bit. For example, DISABLE_RA10_ANALOG() disables analog functionality on port A pin 10.
Definition at line 148 of file pic24_ports.h.
#define DISABLE_Rxy_CN_INTERRUPT | ( | ) | _CNmIE = 0 |
Disables the change notification interrupt on port x, pin y. For example, DISABLE_RA10_CN_INTERRUPT() disables the change notification interrupt on port A, pin 10.
Definition at line 187 of file pic24_ports.h.
#define DISABLE_Rxy_OPENDRAIN | ( | ) | _ODCxy = 0 |
Disables the open-drain driver on port x, pin y. For example, DISABLE_Rxy_OPENDRAIN()
Definition at line 165 of file pic24_ports.h.
#define DISABLE_Rxy_PULLUP | ( | ) | _CNmPUE = 1 |
Disable the pullup on port x, pin y. For example, DISABLE_RA10_PULLUP() disables the pullup on port A, pin 10.
Definition at line 175 of file pic24_ports.h.
#define ENABLE_Rxy_ANALOG | ( | ) | _PCFGn = 0 |
Enables analog functionality on port x of pin y by clearing the corresponding _PCFGn bit. For example, ENABLE_RA10_ANALOG() enables analog functionality on port A pin 10.
Definition at line 142 of file pic24_ports.h.
#define ENABLE_Rxy_CN_INTERRUPT | ( | ) | _CNmIE = 1 |
Enables the change notification interrupt on port x, pin y. For example, ENABLE_RA10_CN_INTERRUPT() enables the change notification interrupt on port A, pin 10.
Definition at line 181 of file pic24_ports.h.
#define ENABLE_Rxy_OPENDRAIN | ( | ) | _ODCxy = 1 |
Enables the open-drain driver on port x, pin y. For example, ENABLE_Rxy_OPENDRAIN()
Definition at line 160 of file pic24_ports.h.
#define ENABLE_Rxy_PULLUP | ( | ) | _CNmPUE = 1 |
Enable the pullup on port x, pin y. For example, ENABLE_RA10_PULLUP() enables the pullup on port A, pin 10.
Definition at line 170 of file pic24_ports.h.
static void CONFIG_ANx_AS_ANALOG | ( | ) | [inline, static] |
This macro first calls CONFIG_Rxy_AS_DIG_INPUT() to disable pullups on the pin then enables analog functionality on the pin. For example, CONFIG_AN1_AS_ANALOG() makes AN1 an analog input pin.
Definition at line 117 of file pic24_ports.h.
static void CONFIG_Rxy_AS_DIG_INPUT | ( | ) | [inline, static] |
This macro disables pullups and analog functionality and sets the pin as an input. For example, CONFIG_RA10_AS_DIG_OUTPUT() makes port A, pin 10 a digital input.
Definition at line 111 of file pic24_ports.h.
static void CONFIG_Rxy_AS_DIG_OD_OUTPUT | ( | ) | [inline, static] |
This macro enables open-drain, disables pullups, configures port x pin y for digital (not analog) operation, and sets the pin as an output. For example, CONFIG_RA10_AS_DIG_OD_OUTPUT() makes port A, pin 10 a digital output.
Definition at line 105 of file pic24_ports.h.
static void CONFIG_Rxy_AS_DIG_OUTPUT | ( | ) | [inline, static] |
This macro disables open-drain and pullups, configures port x pin y for digital (not analog) operation, and sets the pin as an output. For example, CONFIG_RA10_AS_DIG_OUTPUT() makes port A, pin 10 a digital output.
Definition at line 98 of file pic24_ports.h.