English
Language : 

PIC16F72 Datasheet, PDF (27/136 Pages) Microchip Technology – 28-Pin, 8-Bit CMOS FLASH MCU with A/D Converter
3.3 PORTC and the TRISC Register
PORTC is an 8-bit wide, bi-directional port. The corre-
sponding data direction register is TRISC. Setting a
TRISC bit (= 1) will make the corresponding PORTC
pin an input (i.e., put the corresponding output driver in
a Hi-Impedance mode). Clearing a TRISC bit (= 0) will
make the corresponding PORTC pin an output (i.e., put
the contents of the output latch on the selected pin).
PORTC is multiplexed with several peripheral functions
(Table 3-5). PORTC pins have Schmitt Trigger input
buffers.
When enabling peripheral functions, care should be
taken in defining TRIS bits for each PORTC pin. Some
peripherals override the TRIS bit to make a pin an out-
put, while other peripherals override the TRIS bit to
make a pin an input. Since the TRIS bit override is in
effect while the peripheral is enabled, read-modify-
write instructions (BSF, BCF, XORWF) with TRISC as
destination should be avoided. The user should refer to
the corresponding peripheral section for the correct
TRIS bit settings.
EXAMPLE 3-3:
BANKSEL PORTC
CLRF
PORTC
BANKSEL TRISC
MOVLW
0xCF
MOVWF
TRISC
INITIALIZING PORTC
; Select Bank for PORTC
; Initialize PORTC by
; clearing output
; data latches
; Select Bank for TRISC
; Value used to
; initialize data
; direction
; Set RC<3:0> as inputs
; RC<5:4> as outputs
; RC<7:6> as inputs
PIC16F72
FIGURE 3-5:
PORTC BLOCK DIAGRAM
(PERIPHERAL OUTPUT
OVERRIDE)
Port/Peripheral Select(1)
Peripheral Data Out
Data
0
Bus
DQ
WR
Port
1
CK Q
Data Latch
WR
TRIS
DQ
CK Q
TRIS Latch
VDD
VDD
P
I/O
pin
N VSS
VSS
Peripheral
OE(2)
RD TRIS
Schmitt
Trigger
QD
RD
EN
Port
Peripheral Input
Note 1: Port/Peripheral select signal selects
between port data and peripheral output.
2: Peripheral OE (output enable) is only
activated if peripheral select is active.
 2002 Microchip Technology Inc.
DS39597B-page 25