English
Language : 

PIC16F870_13 Datasheet, PDF (37/172 Pages) Microchip Technology – 28/40-Pin, 8-Bit CMOS FLASH Microcontrollers
PIC16F870/871
4.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 4-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
the destination should be avoided. The user should
refer to the corresponding peripheral section for the
correct TRIS bit settings.
FIGURE 4-5:
Port/Peripheral Select(2)
PORTC BLOCK DIAGRAM
(PERIPHERAL OUTPUT
OVERRIDE)
Peripheral Data Out
Data Bus
0
DQ
WR
1
PORT
CK Q
Data Latch
WR
TRIS
DQ
CK Q
TRIS Latch
VDD
P
I/O
pin(1)
N
Vss
Peripheral
OE(3)
RD TRIS
Schmitt
Trigger
QD
RD
EN
PORT
Peripheral Input
Note 1:
2:
3:
I/O pins have diode protection to VDD and VSS.
Port/Peripheral Select signal selects between
port data and peripheral output.
Peripheral OE (Output Enable) is only activated
if Peripheral Select is active.
TABLE 4-5: PORTC FUNCTIONS
Name
Bit# Buffer Type
Function
RC0/T1OSO/T1CKI bit0
ST
RC1/T1OSI
bit1
ST
RC2/CCP1
bit2
ST
RC3
RC4
RC5
RC6/TX/CK
bit3
ST
bit4
ST
bit5
ST
bit6
ST
RC7/RX/DT
bit7
ST
Legend: ST = Schmitt Trigger input
Input/output port pin or Timer1 oscillator output/Timer1 clock input.
Input/output port pin or Timer1 oscillator input.
Input/output port pin or Capture1 input/Compare1 output/
PWM1 output.
Input/output port pin.
Input/output port pin.
Input/output port pin.
Input/output port pin or USART Asynchronous Transmit or
Synchronous Clock.
Input/output port pin or USART Asynchronous Receive or
Synchronous Data.
TABLE 4-6: SUMMARY OF REGISTERS ASSOCIATED WITH PORTC
Address Name
Bit 7
Bit 6
Bit 5
Bit 4
Bit 3
Bit 2
Bit 1
Bit 0
Value on:
POR, BOR
Value on
all other
RESETS
07h
87h
Legend:
PORTC RC7 RC6 RC5 RC4
TRISC PORTC Data Direction Register
x = unknown, u = unchanged
RC3
RC2
RC1
RC0 xxxx xxxx uuuu uuuu
1111 1111 1111 1111
 2000-2013 Microchip Technology Inc.
DS30569C-page 37