English
Language : 

PIC17C7XX_13 Datasheet, PDF (84/306 Pages) Microchip Technology – High-Performance 8-bit CMOS EPROM Microcontrollers with 10-bit A/D
PIC17C7XX
10.6 PORTF and DDRF Registers
PORTF is an 8-bit wide bi-directional port. The corre-
sponding data direction register is DDRF. A '1' in DDRF
configures the corresponding port pin as an input. A '0'
in the DDRF register configures the corresponding port
pin as an output. Reading PORTF reads the status of
the pins, whereas writing to PORTF will write to the
respective port latch.
All eight bits of PORTF are multiplexed with 8 channels
of the 10-bit A/D converter.
Upon RESET, the entire Port is automatically config-
ured as analog inputs and must be configured in soft-
ware to be a digital I/O.
Example 10-6 shows an instruction sequence to initial-
ize PORTF. The Bank Select Register (BSR) must be
selected to Bank 5 for the port to be initialized. The fol-
lowing example uses the MOVLB instruction to load the
BSR register for bank selection.
EXAMPLE 10-6: INITIALIZING PORTF
MOVLB
MOVWF
MOVWF
CLRF
MOVLW
MOVWF
5
0x0E
ADCON1
PORTF, F
0x03
DDRF
; Select Bank 5
; Configure PORTF as
; Digital
; Initialize PORTF data
; latches before
; the data direction
; register
; Value used to init
; data direction
; Set RF<1:0> as inputs
; RF<7:2> as outputs
FIGURE 10-13: BLOCK DIAGRAM OF RF7:RF0
Data Bus
DQ
VDD
WR PORTF
CK Q
P
Data Latch
DQ
N
WR DDRF
CK Q
VSS
DDRF Latch
RD DDRF
RD PORTF
VAIN
PCFG3:PCFG0
CHS3:CHS0
QD
EENN
To other pads
To other pads
Note: I/O pins have protection diodes to VDD and VSS.
I/O pin
ST
Input
Buffer
DS30289C-page 84
 1998-2013 Microchip Technology Inc.