English
Language : 

PIC18F1XK22 Datasheet, PDF (90/388 Pages) Microchip Technology – 20-Pin Flash Microcontrollers with nanoWatt XLP Technology
PIC18F1XK22/LF1XK22
8.3 PORTC, TRISC and LATC
Registers
PORTC is an 8-bit wide, bidirectional port. The corre-
sponding data direction register is TRISC. Setting a
TRISC bit (= 1) will make the corresponding PORTC
pin an input (i.e., disable the output driver). 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).
The PORTC Data Latch register (LATC) is also
memory mapped. Read-modify-write operations on the
LATC register read and write the latched output value
for PORTC.
All the pins on PORTC are implemented with Schmitt
Trigger input buffer. Each pin is individually configu-
rable as an input or output.
Note:
On a Power-on Reset, RC<7:6> and
RC<3:0> are configured as analog inputs
and read as ‘0’.
EXAMPLE 8-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
REGISTER 8-11: PORTC: PORTC REGISTER
R/W-x
RC7
bit 7
R/W-x
RC6
R/W-x
RC5
R/W-x
RC4
R/W-x
RC3
R/W-x
RC2
R/W-x
RC1
R/W-x
RC0
bit 0
Legend:
R = Readable bit
-n = Value at POR
W = Writable bit
‘1’ = Bit is set
U = Unimplemented bit, read as ‘0’
‘0’ = Bit is cleared
x = Bit is unknown
bit 7-0
RC<7:0>: PORTC I/O Pin bits
1 = Port pin is > VIH
0 = Port pin is < VIL
REGISTER 8-12: TRISC: PORTC TRI-STATE REGISTER
R/W-1
TRISC7
bit 7
R/W-1
TRISC6
R/W-1
TRISC5
R/W-1
TRISC4
R/W-1
TRISC3
R/W-1
TRISC2
R/W-1
TRISC1
R/W-1
TRISC0
bit 0
Legend:
R = Readable bit
-n = Value at POR
W = Writable bit
‘1’ = Bit is set
U = Unimplemented bit, read as ‘0’
‘0’ = Bit is cleared
x = Bit is unknown
bit 7-0
TRISC<7:0>: PORTC Tri-State Control bits
1 = PORTC pin configured as an input (tri-stated)
0 = PORTC pin configured as an output
DS41365D-page 90
Preliminary
 2010 Microchip Technology Inc.