Microchip Technology MA330031 Data Sheet

Page of 530
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X AND PIC24EPXXXGP/MC20X
DS70000657H-page 176
 2011-2013 Microchip Technology Inc.
11.4.4
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 (see 
through 
). Each register contains sets of
7-bit fields, with each set associated with one of the
remappable peripherals. Programming a given periph-
eral’s bit field with an appropriate 7-bit value maps the
RPn pin with the corresponding value to that peripheral.
For any given device, the valid range of values for any
bit field corresponds to the maximum number of
Peripheral Pin Selections supported by the device.
For example, 
 illustrates remappable pin
selection for the U1RX input.
FIGURE 11-2:
REMAPPABLE INPUT FOR 
U1RX
11.4.4.1
Virtual Connections
dsPIC33EPXXXGP50X, dsPIC33EPXXXMC20X/50X
and PIC24EPXXXGP/MC20X devices support virtual
(internal) connections to the output of the op amp/
comparator module (see 
 in 
), and the PTG
module (see 
).
In addition, dsPIC33EPXXXMC20X/50X and
PIC24EPXXXMC20X devices support virtual connec-
tions to the filtered QEI module inputs: FINDX1,
FHOME1, FINDX2 and FHOME2 (see 
in 
Virtual connections provide a simple way of inter-
peripheral connection without utilizing a physical pin.
For example, by setting the FLT1R<6:0> bits of the
RPINR12 register to the value of ‘b0000001, the
output of the analog comparator, C1OUT, will be
connected to the PWM Fault 1 input, which allows the
analog comparator to trigger PWM Faults without the
use of an actual physical pin on the device.
Virtual connection to the QEI module allows
peripherals to be connected to the QEI digital filter
input. To utilize this filter, the QEI module must be
enabled and its inputs must be connected to a physical
RPn pin. 
 illustrates how the input
capture module can be connected to the QEI digital
filter.
EXAMPLE 11-2:
CONNECTING IC1 TO THE HOME1 QEI1 DIGITAL FILTER INPUT ON PIN 43 OF 
THE dsPIC33EPXXXMC206 DEVICE
RP0
RP1
RP3
0
1
2
U1RX Input
U1RXR<6:0>
to Peripheral
RPn
n
Note:
For input only, Peripheral Pin Select func-
tionality does not have priority over TRISx
settings. Therefore, when configuring an
RPn pin for input, the corresponding bit in
the TRISx register must also be configured
for input (set to ‘1’).
RPINR15 = 0x2500;
/* Connect the QEI1 HOME1 input to RP37 (pin 43) */
RPINR7  = 0x009;
/* Connect the IC1 input to the digital filter on the FHOME1 input */
QEI1IOC = 0x4000;
/* Enable the QEI digital filter */
QEI1CON = 0x8000;
/* Enable the QEI module */