Datasheet

PIC16C712/716
DS41106C-page 24 1999-2013 Microchip Technology Inc.
3.2 PORTB and the TRISB Register
PORTB is an 8-bit wide bidirectional port. The corre-
sponding data direction register is TRISB. Setting a
TRISB bit (= 1) will make the corresponding PORTB
pin an input, (i.e., put the corresponding output driver in
a High-Impedance mode). Clearing a TRISB bit (= 0)
will make the corresponding PORTB pin an output,
(i.e., put the contents of the output latch on the selected
pin).
EXAMPLE 3-2: INITIALIZING PORTB
Each of the PORTB pins has a weak internal pull-up. A
single control bit can turn on all the pull-ups. This is per-
formed by clearing bit RBPU (OPTION_REG<7>). The
weak pull-up is automatically turned off when the port
pin is configured as an output. The pull-ups are
disabled on a Power-on Reset.
FIGURE 3-3: BLOCK DIAGRAM OF RB0 PIN
BCF STATUS, RP0 ;
CLRF PORTB ; Initialize PORTB by
; clearing output
; data latches
BSF STATUS, RP0 ; Select Bank 1
MOVLW 0xCF ; Value used to
; initialize data
; direction
MOVWF TRISB ; Set RB<3:0> as inputs
; RB<5:4> as outputs
; RB<7:6> as inputs
Data Latch
RBPU
(1)
P
V
DD
QD
CK
QD
CK
QD
EN
DATA BUS
WR PORT
WR TRIS
RD TRIS
RD PORT
weak
pull-up
RD PORT
RB0/INT
I/O
pin
TTL
Input
Buffer
Schmitt Trigger
Buffer
TRIS Latch
Note 1: To enable weak pull-ups, set the appropriate TRIS bit(s) and clear the RBPU bit (OPTION_REG<7>).
VSS
VDD