PIC17C75X
Example 10-2 shows an instruction sequence to initial-
ize PORTB. The Bank Select Register (BSR) must be
selected to Bank 0 for the port to be initialized. The fol-
lowing example uses the
MOVLB
instruction to load the
BSR register for bank selection.
EXAMPLE 10-2: INITIALIZING PORTB
MOVLB
CLRF
MOVLW
MOVWF
0
PORTB
0xCF
DDRB
;
;
;
;
;
;
;
;
Select Bank 0
Initialize PORTB by clearing
output data latches
Value used to initialize
data direction
Set RB<3:0> as inputs
RB<5:4> as outputs
RB<7:6> as inputs
FIGURE 10-6: BLOCK DIAGRAM OF RB3:RB2 PORT PINS
Peripheral Data in
RBPU (PORTA<7>)
Weak
Pull-Up
Match Signal
from other
port pins
RBIF
Port
Input Latch
Data Bus
RD_DDRB (Q2)
RD_PORTB (Q2)
D
OE
Q
CK
D
Port
Data
Q
CK
R
WR_PORTB (Q4)
WR_DDRB (Q4)
Peripheral_output
Peripheral_enable
Note: I/O pins have protection diodes to V
DD
and Vss.
漏
1997 Microchip Technology Inc.
Preliminary
DS30264A-page 69