9.1 Parallel I/O (PIO) Ports

All port pins have 12 registers directly associated with their operation as digital I/Os. The Data Direction register (TRISx) determines whether the pin is an input or an output. If the data direction bit is a ‘1’, then the pin is an input.

All port pins are defined as inputs after a Reset. Reads from the latch (LATx), read the latch. Writes to the latch, write the latch. Reads from the port (PORTx), read the port pins, while writes to the port pins, write the latch. Any bit and its associated data and control registers that are not valid for a particular device are disabled. This means the corresponding LATx and TRISx registers, and the port pin are read as zeros.

When a pin is shared with another peripheral or function that is defined as an input only, it is nevertheless regarded as a dedicated port because there is no other competing source of outputs. Table 9-1 shows the pin availability. Figure 9-1 shows the 5V input tolerant pins across this device.

Table 9-1. Pin and ANSELx Availability
DeviceRx15Rx14Rx13Rx12Rx11Rx10Rx9Rx8Rx7Rx6Rx5Rx4Rx3Rx2Rx1Rx0
PORTA
dsPIC33CKXXXMPT608-I/PTXXXXX
ANSELAXXXXX
PORTB
dsPIC33CKXXXMPT608-I/PTXXXXXXXXXXXXXXXX
ANSELBXXXXXXX
PORTC
dsPIC33CKXXXMPT608-I/PTXXXXXXXXXXXX
ANSELCXXXXXX
PORTD
dsPIC33CKXXXMPT608-I/PTXXXXXXXXXXXXXX
ANSELDXXX
PORTE
dsPIC33CKXXXMPT608-I/PTXXXXXXXXXXXXXXX
ANSELEXXXX
Figure 9-1. Block Diagram of a Typical Shared Port Structure