PIC24 Support Libraries
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
pic24_ports.h File Reference
#include "pic24_ports_mapping.h"
#include "pic24_ports_config.h"

Go to the source code of this file.

Macros

Remappable peripheral input support

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.

#define CONFIG_INT1_TO_RP(pin)   _INT1R = pin
 
#define CONFIG_INT2_TO_RP(pin)   _INT2R = pin
 
#define CONFIG_INT3_TO_RP(pin)   _INT3R = pin
 
#define CONFIG_INT4_TO_RP(pin)   _INT4R = pin
 
#define CONFIG_T1CK_TO_RP(pin)   _T1CKR = 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_T6CK_TO_RP(pin)   _T6CKR = pin
 
#define CONFIG_T7CK_TO_RP(pin)   _T7CKR = pin
 
#define CONFIG_T8CK_TO_RP(pin)   _T8CKR = pin
 
#define CONFIG_T9CK_TO_RP(pin)   _T9CKR = 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_CDSI_TO_RP(pin)   _CSDIR = pin
 
#define CONFIG_CSCKIN_TO_RP(pin)   _CSCKINR = pin
 
#define CONFIG_COFSIN_TO_RP(pin)   _COFSINR = pin
 
#define CONFIG_C1RX_TO_RP(pin)   _C1RXR = pin
 
#define CONFIG_C2RX_TO_RP(pin)   _C2RXR = pin
 
Remappable peripheral output support
Todo:
More mappings, starting with U3RX for the dsPIC33E.

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.

#define RPMAP_NONE   0
 
#define RPMAP_C1OUT   1
 
#define RPMAP_C2OUT   2
 
#define RPMAP_U1TX   3
 
#define RPMAP_U1RTS   4
 
#define RPMAP_U2TX   5
 
#define RPMAP_U2RTS   6
 
#define RPMAP_SD01   7
 
#define RPMAP_SCK1OUT   8
 
#define RPMAP_SS1OUT   9
 
#define RPMAP_SDO2   10
 
#define RPMAP_SCK2OUT   11
 
#define RPMAP_SS2OUT   12
 
#define RPMAP_C1TX   16
 
#define RPMAP_OC1   18
 
#define RPMAP_OC2   19
 
#define RPMAP_OC3   20
 
#define RPMAP_OC4   21
 
#define RPMAP_OC5   22
 
#define CONFIG_NULL_TO_RP(Rxy_RP)   _CONFIG_NULL_TO_RP(Rxy_RP)
 
#define _CONFIG_NULL_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_NONE)
 
#define CONFIG_C1OUT_TO_RP(Rxy_RP)   _CONFIG_C1OUT_TO_RP(Rxy_RP)
 
#define _CONFIG_C1OUT_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_C1OUT)
 
#define CONFIG_C2OUT_TO_RP(Rxy_RP)   _CONFIG_C2OUT_TO_RP(Rxy_RP)
 
#define _CONFIG_C2OUT_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_C2OUT)
 
#define CONFIG_U1TX_TO_RP(Rxy_RP)   _CONFIG_U1TX_TO_RP(Rxy_RP)
 
#define _CONFIG_U1TX_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_U1TX)
 
#define CONFIG_U1RTS_TO_RP(Rxy_RP)   _CONFIG_U1RTS_TO_RP(Rxy_RP)
 
#define _CONFIG_U1RTS_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_U1RTS)
 
#define CONFIG_U2TX_TO_RP(Rxy_RP)   _CONFIG_U2TX_TO_RP(Rxy_RP)
 
#define _CONFIG_U2TX_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_U2TX)
 
#define CONFIG_U2RTS_TO_RP(Rxy_RP)   _CONFIG_U2RTS_TO_RP(Rxy_RP)
 
#define _CONFIG_U2RTS_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_U2RTS)
 
#define CONFIG_SDO1_TO_RP(Rxy_RP)   _CONFIG_SDO1_TO_RP(Rxy_RP)
 
#define _CONFIG_SDO1_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_SD01)
 
#define CONFIG_SCK1OUT_TO_RP(Rxy_RP)   _CONFIG_SCK1OUT_TO_RP(Rxy_RP)
 
#define _CONFIG_SCK1OUT_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_SCK1OUT)
 
#define CONFIG_SS1OUT_TO_RP(Rxy_RP)   _CONFIG_SS1OUT_TO_RP(Rxy_RP)
 
#define _CONFIG_SS1OUT_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_SS1OUT)
 
#define CONFIG_SDO2_TO_RP(Rxy_RP)   _CONFIG_SDO2_TO_RP(Rxy_RP)
 
#define _CONFIG_SDO2_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_SDO2)
 
#define CONFIG_SCK2OUT_TO_RP(Rxy_RP)   _CONFIG_SCK2OUT_TO_RP(Rxy_RP)
 
#define _CONFIG_SCK2OUT_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_SCK2OUT)
 
#define CONFIG_SS2OUT_TO_RP(Rxy_RP)   _CONFIG_SS2OUT_TO_RP(Rxy_RP)
 
#define _CONFIG_SS2OUT_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_SS2OUT)
 
#define CONFIG_C1TX_TO_RP(Rxy_RP)   _CONFIG_C1TX_TO_RP(Rxy_RP)
 
#define _CONFIG_C1TX_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_C1TX)
 
#define CONFIG_OC1_TO_RP(Rxy_RP)   _CONFIG_OC1_TO_RP(Rxy_RP)
 
#define _CONFIG_OC1_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_OC1)
 
#define CONFIG_OC2_TO_RP(Rxy_RP)   _CONFIG_OC2_TO_RP(Rxy_RP)
 
#define _CONFIG_OC2_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_OC2)
 
#define CONFIG_OC3_TO_RP(Rxy_RP)   _CONFIG_OC3_TO_RP(Rxy_RP)
 
#define _CONFIG_OC3_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_OC3)
 
#define CONFIG_OC4_TO_RP(Rxy_RP)   _CONFIG_OC4_TO_RP(Rxy_RP)
 
#define _CONFIG_OC4_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_OC4)
 
#define CONFIG_OC5_TO_RP(Rxy_RP)   _CONFIG_OC5_TO_RP(Rxy_RP)
 
#define _CONFIG_OC5_TO_RP(Rxy_RP)   (_RP##Rxy_RP##R = RPMAP_OC5)
 

Detailed Description

This file defines a series of macros which provide GPIO and related configuration for each pin of a given PIC24/dsPIC33. Configuration is first defined at a low level, by providing the following:

Related low-level configuration:

Combining these produces higher-level configuration:

Implementation notes

Todo:
Explain double macros

Definition in file pic24_ports.h.

Macro Definition Documentation

#define CONFIG_C1OUT_TO_RP (   Rxy_RP)    _CONFIG_C1OUT_TO_RP(Rxy_RP)

Maps C1OUT to a remappable pin; see remappable peripheral output support for more information.

Definition at line 486 of file pic24_ports.h.

#define CONFIG_C1RX_TO_RP (   pin)    _C1RXR = pin

Maps C1RX to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 378 of file pic24_ports.h.

#define CONFIG_C1TX_TO_RP (   Rxy_RP)    _CONFIG_C1TX_TO_RP(Rxy_RP)

Maps C1TX to a remappable pin; see remappable peripheral output support for more information.

Definition at line 558 of file pic24_ports.h.

#define CONFIG_C2OUT_TO_RP (   Rxy_RP)    _CONFIG_C2OUT_TO_RP(Rxy_RP)

Maps C2OUT to a remappable pin; see remappable peripheral output support for more information.

Definition at line 492 of file pic24_ports.h.

#define CONFIG_C2RX_TO_RP (   pin)    _C2RXR = pin

Maps C2RX to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 385 of file pic24_ports.h.

#define CONFIG_CDSI_TO_RP (   pin)    _CSDIR = pin

Maps CSDI to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 357 of file pic24_ports.h.

#define CONFIG_COFSIN_TO_RP (   pin)    _COFSINR = pin

Maps COFSIN to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 371 of file pic24_ports.h.

#define CONFIG_CSCKIN_TO_RP (   pin)    _CSCKINR = pin

Maps CSCKIN to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 364 of file pic24_ports.h.

#define CONFIG_IC1_TO_RP (   pin)    _IC1R = pin

Maps IC1 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 215 of file pic24_ports.h.

#define CONFIG_IC2_TO_RP (   pin)    _IC2R = pin

Maps IC2 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 222 of file pic24_ports.h.

#define CONFIG_IC3_TO_RP (   pin)    _IC3R = pin

Maps IC3 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 229 of file pic24_ports.h.

#define CONFIG_IC4_TO_RP (   pin)    _IC4R = pin

Maps IC4 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 236 of file pic24_ports.h.

#define CONFIG_IC5_TO_RP (   pin)    _IC5R = pin

Maps IC5 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 243 of file pic24_ports.h.

#define CONFIG_IC6_TO_RP (   pin)    _IC6R = pin

Maps IC6 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 250 of file pic24_ports.h.

#define CONFIG_IC7_TO_RP (   pin)    _IC7R = pin

Maps IC7 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 257 of file pic24_ports.h.

#define CONFIG_IC8_TO_RP (   pin)    _IC8R = pin

Maps IC8 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 264 of file pic24_ports.h.

#define CONFIG_INT1_TO_RP (   pin)    _INT1R = pin

Maps INT1 to a remappable pin; see remappable peripheral input support for more information.

Definition at line 124 of file pic24_ports.h.

#define CONFIG_INT2_TO_RP (   pin)    _INT2R = pin

Maps INT2 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 131 of file pic24_ports.h.

#define CONFIG_INT3_TO_RP (   pin)    _INT3R = pin

Maps INT3 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 138 of file pic24_ports.h.

#define CONFIG_INT4_TO_RP (   pin)    _INT4R = pin

Maps INT4 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 145 of file pic24_ports.h.

#define CONFIG_NULL_TO_RP (   Rxy_RP)    _CONFIG_NULL_TO_RP(Rxy_RP)

CONFIG_NULL_TO_RP(n) returns RPn to an 'unmapped' state (i.e, the reset condition).

Definition at line 480 of file pic24_ports.h.

#define CONFIG_OC1_TO_RP (   Rxy_RP)    _CONFIG_OC1_TO_RP(Rxy_RP)

Maps OC1 to a remappable pin; see remappable peripheral output support for more information.

Definition at line 564 of file pic24_ports.h.

#define CONFIG_OC2_TO_RP (   Rxy_RP)    _CONFIG_OC2_TO_RP(Rxy_RP)

Maps OC2 to a remappable pin; see remappable peripheral output support for more information.

Definition at line 570 of file pic24_ports.h.

#define CONFIG_OC3_TO_RP (   Rxy_RP)    _CONFIG_OC3_TO_RP(Rxy_RP)

Maps OC3 to a remappable pin; see remappable peripheral output support for more information.

Definition at line 576 of file pic24_ports.h.

#define CONFIG_OC4_TO_RP (   Rxy_RP)    _CONFIG_OC4_TO_RP(Rxy_RP)

Maps OC4 to a remappable pin; see remappable peripheral output support for more information.

Definition at line 582 of file pic24_ports.h.

#define CONFIG_OC5_TO_RP (   Rxy_RP)    _CONFIG_OC5_TO_RP(Rxy_RP)

Maps OC5 to a remappable pin; see remappable peripheral output support for more information.

Definition at line 588 of file pic24_ports.h.

#define CONFIG_OCFA_TO_RP (   pin)    _OCFAR = pin

Maps OCFA to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 271 of file pic24_ports.h.

#define CONFIG_OCFB_TO_RP (   pin)    _OCFBR = pin

Maps OCFB to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 278 of file pic24_ports.h.

#define CONFIG_SCK1IN_TO_RP (   pin)    _SCK1R = pin

Maps SCK1 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 322 of file pic24_ports.h.

#define CONFIG_SCK1OUT_TO_RP (   Rxy_RP)    _CONFIG_SCK1OUT_TO_RP(Rxy_RP)

Maps SCK1OUT to a remappable pin; see remappable peripheral output support for more information.

Definition at line 528 of file pic24_ports.h.

#define CONFIG_SCK2IN_TO_RP (   pin)    _SCK2R = pin

Maps SCK2 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 343 of file pic24_ports.h.

#define CONFIG_SCK2OUT_TO_RP (   Rxy_RP)    _CONFIG_SCK2OUT_TO_RP(Rxy_RP)

Maps SCK2OUT to a remappable pin; see remappable peripheral output support for more information.

Definition at line 546 of file pic24_ports.h.

#define CONFIG_SDI1_TO_RP (   pin)    _SDI1R = pin

Maps SDI1 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 315 of file pic24_ports.h.

#define CONFIG_SDI2_TO_RP (   pin)    _SDI2R = pin

Maps SDI2 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 336 of file pic24_ports.h.

#define CONFIG_SDO1_TO_RP (   Rxy_RP)    _CONFIG_SDO1_TO_RP(Rxy_RP)

Maps SDO1 to a remappable pin; see remappable peripheral output support for more information.

Definition at line 522 of file pic24_ports.h.

#define CONFIG_SDO2_TO_RP (   Rxy_RP)    _CONFIG_SDO2_TO_RP(Rxy_RP)

Maps SDO2 to a remappable pin; see remappable peripheral output support for more information.

Definition at line 540 of file pic24_ports.h.

#define CONFIG_SS1IN_TO_RP (   pin)    _SS1R = pin

Maps SS1 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 329 of file pic24_ports.h.

#define CONFIG_SS1OUT_TO_RP (   Rxy_RP)    _CONFIG_SS1OUT_TO_RP(Rxy_RP)

Maps SS11OUT to a remappable pin; see remappable peripheral output support for more information.

Definition at line 534 of file pic24_ports.h.

#define CONFIG_SS2IN_TO_RP (   pin)    _SS2R = pin

Maps SS2 to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 350 of file pic24_ports.h.

#define CONFIG_SS2OUT_TO_RP (   Rxy_RP)    _CONFIG_SS2OUT_TO_RP(Rxy_RP)

Maps SS2OUT to a remappable pin; see remappable peripheral output support for more information.

Definition at line 552 of file pic24_ports.h.

#define CONFIG_T1CK_TO_RP (   pin)    _T1CKR = pin

Maps T1CK to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 152 of file pic24_ports.h.

#define CONFIG_T2CK_TO_RP (   pin)    _T2CKR = pin

Maps T2CK to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 159 of file pic24_ports.h.

#define CONFIG_T3CK_TO_RP (   pin)    _T3CKR = pin

Maps T3CK to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 166 of file pic24_ports.h.

#define CONFIG_T4CK_TO_RP (   pin)    _T4CKR = pin

Maps T4CK to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 173 of file pic24_ports.h.

#define CONFIG_T5CK_TO_RP (   pin)    _T5CKR = pin

Maps T5CK to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 180 of file pic24_ports.h.

#define CONFIG_T6CK_TO_RP (   pin)    _T6CKR = pin

Maps T6CK to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 187 of file pic24_ports.h.

#define CONFIG_T7CK_TO_RP (   pin)    _T7CKR = pin

Maps T7CK to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 194 of file pic24_ports.h.

#define CONFIG_T8CK_TO_RP (   pin)    _T8CKR = pin

Maps T8CK to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 201 of file pic24_ports.h.

#define CONFIG_T9CK_TO_RP (   pin)    _T9CKR = pin

Maps T9CK to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 208 of file pic24_ports.h.

#define CONFIG_U1CTS_TO_RP (   pin)    _U1CTSR = pin

Maps U1CTS to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 294 of file pic24_ports.h.

#define CONFIG_U1RTS_TO_RP (   Rxy_RP)    _CONFIG_U1RTS_TO_RP(Rxy_RP)

Maps U1RTS to a remappable pin; see remappable peripheral output support for more information.

Definition at line 504 of file pic24_ports.h.

#define CONFIG_U1RX_TO_RP (   pin)    _U1RXR = pin
Todo:
More mapping for dsPIC33E missing here, starting with FLT1.

Maps U1RX to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 287 of file pic24_ports.h.

Referenced by __esos_configUART1(), and configUART1().

#define CONFIG_U1TX_TO_RP (   Rxy_RP)    _CONFIG_U1TX_TO_RP(Rxy_RP)

Maps U1TX to a remappable pin; see remappable peripheral output support for more information.

Definition at line 498 of file pic24_ports.h.

Referenced by __esos_configUART1(), and configUART1().

#define CONFIG_U2CTS_TO_RP (   pin)    _U2CTSR = pin

Maps U2CTS to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 308 of file pic24_ports.h.

#define CONFIG_U2RTS_TO_RP (   Rxy_RP)    _CONFIG_U2RTS_TO_RP(Rxy_RP)

Maps U2RTS to a remappable pin; see remappable peripheral output support for more information.

Definition at line 516 of file pic24_ports.h.

#define CONFIG_U2RX_TO_RP (   pin)    _U2RXR = pin

Maps U2RX to a remappable pin; see remappable peripheral input support for more informatino.

Definition at line 301 of file pic24_ports.h.

#define CONFIG_U2TX_TO_RP (   Rxy_RP)    _CONFIG_U2TX_TO_RP(Rxy_RP)

Maps U2TX to a remappable pin; see remappable peripheral output support for more information.

Definition at line 510 of file pic24_ports.h.

#define RPMAP_NONE   0

Define peripheral pins. This is defined in pps.h or PPS.h as e.g. OUT_FN_PPS_U1TX, but that file doesn't exist for the 24H, 33F, 24E, or 33E.

Definition at line 442 of file pic24_ports.h.