English
Language : 

PIC18F87J10 Datasheet, PDF (132/394 Pages) Microchip Technology – 64/80-Pin High-Performance, 1-Mbit Flash Microcontrollers with nanoWatt Technology
PIC18F87J10 FAMILY
10.7 PORTF, LATF and TRISF Registers
PORTF is a 7-bit wide, bidirectional port. The corre-
sponding data direction register is TRISF. Setting a
TRISF bit (= 1) will make the corresponding PORTF pin
an input (i.e., put the corresponding output driver in a
high-impedance mode). Clearing a TRISF bit (= 0) will
make the corresponding PORTF pin an output (i.e., put
the contents of the output latch on the selected pin).
Only pin 7 of PORTF has no analog input; it is the only
pin that can tolerate voltages up to 5.5V.
The Data Latch register (LATF) is also memory
mapped. Read-modify-write operations on the LATF
register read and write the latched output value for
PORTF.
All pins on PORTF are implemented with Schmitt
Trigger input buffers. Each pin is individually
configurable as an input or output.
PORTF is multiplexed with several analog peripheral
functions, including the A/D converter and comparator
inputs, as well as the comparator outputs. Pins RF2
through RF6 may be used as comparator inputs or
outputs by setting the appropriate bits in the CMCON
register. To use RF3:RF6 as digital inputs, it is also
necessary to turn off the comparators.
Note 1: On device Resets, pins RF6:RF1 are
configured as analog inputs and are read
as ‘0’.
2: To configure PORTF as digital I/O, turn off
comparators and set ADCON1 value.
EXAMPLE 10-6: INITIALIZING PORTF
CLRF
CLRF
MOVLW
MOVWF
MOVLW
MOVWF
MOVLW
MOVWF
PORTF
LATF
07h
CMCON
0Fh;
ADCON1
0CEh
TRISF
; Initialize PORTF by
; clearing output
; data latches
; Alternate method
; to clear output
; data latches
;
; Turn off comparators
; Set PORTF as digital I/O
; Value used to
; initialize data
; direction
; Set RF3:RF1 as inputs
; RF5:RF4 as outputs
; RF7:RF6 as inputs
DS39663A-page 130
Advance Information
 2005 Microchip Technology Inc.