English
Language : 

PIC17C7XX_13 Datasheet, PDF (75/306 Pages) Microchip Technology – High-Performance 8-bit CMOS EPROM Microcontrollers with 10-bit A/D
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.
PIC17C7XX
EXAMPLE 10-2: INITIALIZING PORTB
MOVLB
CLRF
MOVLW
MOVWF
0
PORTB, F
0xCF
DDRB
; Select Bank 0
; Init 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
Weak
Pull-up
Port
Input Latch
Match Signal
from other
port pins
Peripheral Data In
RBPU (PORTA<7>)
RBIF
Data Bus
RD_DDRB (Q2)
OE
Port
Data
D
Q
CK
Note: I/O pins have protection diodes to VDD and VSS.
D
Q
CK
R
RD_PORTB (Q2)
WR_DDRB (Q4)
WR_PORTB (Q4)
Peripheral_output
Peripheral_enable
 1998-2013 Microchip Technology Inc.
DS30289C-page 75