Datasheet
PIC16(L)F1782/3
DS41579D-page 132 Preliminary 2011-2012 Microchip Technology Inc.
13.7 PORTC Registers
13.7.1 DATA REGISTER
PORTC is an 8-bit wide bidirectional port. The
corresponding data direction register is TRISC
(Register 13-19). Setting a TRISC bit (= 1) will make the
corresponding PORTC pin an input (i.e., put the
corresponding output driver in a High-Impedance mode).
Clearing a TRISC bit (= 0) will make the corresponding
PORTC pin an output (i.e., enable the output driver and
put the contents of the output latch on the selected pin).
Example 13-1 shows how to initialize an I/O port.
Reading the PORTC register (Register 13-18) reads the
status of the pins, whereas writing to it will write to the
PORT latch. All write operations are read-modify-write
operations. Therefore, a write to a port implies that the
port pins are read, this value is modified and then written
to the PORT data latch (LATC).
13.7.2 DIRECTION CONTROL
The TRISC register (Register 13-19) controls the
PORTC pin output drivers, even when they are being
used as analog inputs. The user should ensure the bits in
the TRISC register are maintained set when using them
as analog inputs. I/O pins configured as analog inputs
always read ‘0’.
13.7.3 OPEN DRAIN CONTROL
The ODCONC register (Register 13-22) controls the
open-drain feature of the port. Open drain operation is
independently selected for each pin. When an
ODCONC bit is set, the corresponding port output
becomes an open drain driver capable of sinking
current only. When an ODCONC bit is cleared, the
corresponding port output pin is the standard push-pull
drive capable of sourcing and sinking current.
13.7.4 SLEW RATE CONTROL
The SLRCONC register (Register 13-23) controls the
slew rate option for each port pin. Slew rate control is
independently selectable for each port pin. When an
SLRCONC bit is set, the corresponding port pin drive is
slew rate limited. When an SLRCONC bit is cleared,
The corresponding port pin drive slews at the maximum
rate possible.
13.7.5 INPUT THRESHOLD CONTROL
The INLVLC register (Register 13-24) controls the input
voltage threshold for each of the available PORTC
input pins. A selection between the Schmitt Trigger
CMOS or the TTL Compatible thresholds is available.
The input threshold is important in determining the
value of a read of the PORTC register and also the
level at which an interrupt-on-change occurs, if that
feature is enabled. See Section 30.1 “DC Character-
istics: PIC16(L)F1782/3-I/E (Industrial, Extended)”
for more information on threshold levels.
13.7.6 PORTC FUNCTIONS AND OUTPUT
PRIORITIES
Each PORTC pin is multiplexed with other functions. The
pins, their combined functions and their output priorities
are shown in Table 13-7.
When multiple outputs are enabled, the actual pin
control goes to the peripheral with the highest priority.
Analog input and some digital input functions are not
included in the list below. These input functions can
remain active when the pin is configured as an output.
Certain digital input functions override other port
functions and are included in the priority list.
Note: Changing the input threshold selection
should be performed while all peripheral
modules are disabled. Changing the
threshold level during the time a module is
active may inadvertently generate a
transition associated with an input pin,
regardless of the actual voltage level on
that pin.
TABLE 13-7: PORTC OUTPUT PRIORITY
Pin Name Function Priority
(1)
RC0 T1OSO
PSMC1A
RC0
RC1 PSMC1B
CCP2
RC1
RC2 PSMC1C
CCP1
RC2
RC3 PSMC1D
SCL
SCK
RC3
RC4 PSMC1E
SDA
RC4
RC5 PSMC1F
SDO
RC5
RC6 PSMC2A
TX/CK
RC6
RC7 PSMC2B
DT
RC7
Note 1: Priority listed from highest to lowest.