Datasheet

Table Of Contents
PIC18F85J90 FAMILY
DS39770C-page 128 2010 Microchip Technology Inc.
10.7 PORTF, LATF and TRISF Registers
PORTF is a 7-bit wide, bidirectional port. The
corresponding Data Direction and Data Latch registers
are TRISF and LATF. 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 analog peripheral functions,
as well as LCD segments. Pins RF1 through RF6 may
be used as comparator inputs or outputs by setting the
appropriate bits in the CMCON register. To use
RF<6:3> as digital inputs, it is also necessary to turn off
the comparators.
PORTF is also multiplexed with LCD segment drives
controlled by bits in the LCDSE2 and LCDSE3
registers. I/O port functions are only available when the
segments are disabled.
EXAMPLE 10-6: INITIALIZING PORTF
Note 1: On device Resets, pins, RF<6:1>, are
configured as analog inputs and are read
as ‘0’.
2: To configure PORTF as a digital I/O, turn
off the comparators and set the ADCON1
value.
CLRF PORTF ; Initialize PORTF by
; clearing output
; data latches
CLRF LATF ; Alternate method
; to clear output
; data latches
MOVLW 07h ;
MOVWF CMCON ; Turn off comparators
MOVLW 0Fh ;
MOVWF ADCON1 ; Set PORTF as digital I/O
MOVLW 0CEh ; Value used to
; initialize data
; direction
MOVWF TRISF ; Set RF3:RF1 as inputs
; RF5:RF4 as outputs
; RF7:RF6 as inputs