English
Language : 

PIC18F87K90 Datasheet, PDF (161/566 Pages) Microchip Technology – 64/80-Pin, High-Performance Microcontrollers with LCD Driver and nanoWatt XLP Technology
PIC18F87K90 FAMILY
11.4 PORTC, TRISC and
LATC Registers
PORTC is an 8-bit wide, bidirectional port. The
corresponding Data Direction and Output Latch registers
are TRISC and LATC. Only PORTC pins, RC2 through
RC7, are digital only pins.
PORTC is multiplexed with ECCP, MSSP and EUSART
peripheral functions (Table 11-5). The pins have
Schmitt Trigger input buffers. The pins for ECCP, SPI
and EUSART are also configurable for open-drain out-
put whenever these functions are active. Open-drain
configuration is selected by setting the SSP1OD,
CCPxOD and U1OD control bits in the registers,
ODCON1 and ODCON3.
RC1 is normally configured as the default peripheral
pin for the ECCP2 module. Assignment of ECCP2 is
controlled by Configuration bit, CCP2MX (default state,
CCP2MX = 1).
When enabling peripheral functions, use care in defining
TRIS bits for each PORTC pin. Some peripherals can
override the TRIS bit to make a pin an output or input.
Consult the corresponding peripheral section for the
correct TRIS bit settings.
Note: These pins are configured as digital inputs
on any device Reset.
The contents of the TRISC register are affected by
peripheral overrides. Reading TRISC always returns
the current contents, even though a peripheral device
may be overriding one or more of the pins.
The RC<7:1> pins are multiplexed with LCD segment
drives that are controlled by bits in the registers,
LCDSE1, LCDSE2, LCDSE3 and LCDSE4.
RC0 and RC1 pins serve as the input pins for the
SOSC oscillator. On a power-up, these pins are defined
as SOSC pins. In order to make these ports have digital
I/O port functionality, the CONFI1L<4:3> should be set
to ‘10’ (Digital SCLKI mode). I/O port functionality is
only available when the LCD segments are disabled.
EXAMPLE 11-3: INITIALIZING PORTC
CLRF
CLRF
MOVLW
MOVWF
PORTC
LATC
0CFh
TRISC
; Initialize PORTC by
; clearing output
; data latches
; Alternate method
; to clear output
; data latches
; Value used to
; initialize data
; direction
; Set RC<3:0> as inputs
; RC<5:4> as outputs
; RC<7:6> as inputs
 2010 Microchip Technology Inc.
Preliminary
DS39957B-page 161