Datasheet
2009-2011 Microchip Technology Inc. DS39960D-page 187
PIC18F87K22 FAMILY
TABLE 12-16: SUMMARY OF REGISTERS ASSOCIATED WITH PORTH
12.10 PORTJ, TRISJ and
LATJ Registers
PORTJ is an 8-bit wide, bidirectional port. The
corresponding Data Direction and Output Latch registers
are TRISJ and LATJ.
All pins on PORTJ are implemented with Schmitt
Trigger input buffers. Each pin is individually
configurable as an input or output.
When the external memory interface is enabled, all of
the PORTJ pins function as control outputs for the inter-
face. This occurs automatically when the interface is
enabled by clearing the EBDIS control bit
(MEMCON<7>). The TRISJ bits are also overridden.
Each of the PORTJ pins has a weak internal pull-up.
The pull-ups are provided to keep the inputs at a known
state for the external memory interface while powering
up. A single control bit can turn off all the pull-ups. This
is performed by clearing bit, RJPU (PADCFG1<5>).
The weak pull-up is automatically turned off when the
port pin is configured as an output. The pull-ups are
disabled on any device Reset.
EXAMPLE 12-9: INITIALIZING PORTJ
Name Bit 7 Bit 6 Bit 5 Bit 4 Bit 3 Bit 2 Bit 1 Bit 0
PORTH
(1)
RH7 RH6 RH5 RH4 RH3 RH2 RH1 RH0
LATH
(1)
LATH7 LATH6 LATH5 LATH4 LATH3 LATH2 LATH1 LATH0
TRISH
(1)
TRISH7 TRISH6 TRISH5 TRISH4 TRISH3 TRISH2 TRISH1 TRISH0
ANCON1 ANSEL15 ANSEL14 ANSEL13 ANSEL12
ANSEL11 ANSEL10 ANSEL9 ANSEL8
ANCON2 ANSEL23 ANSEL22 ANSEL21 ANSEL20 ANSEL19 ANSEL18 ANSEL17 ANSEL16
ODCON2 CCP10OD
(2)
CCP9OD
(2)
CCP8OD CCP7OD CCP6OD CCP5OD CCP4OD CCP3OD
Note 1: Unimplemented on 64-pin devices (PIC18F6XK22), read as ‘0’.
2: Unimplemented on PIC18FX5K22 devices, read as ‘0’.
Note: PORTJ is available only on 80-pin devices.
Note: These pins are configured as digital inputs
on any device Reset.
CLRF PORTJ ; Initialize PORTJ by
; clearing output latches
CLRF LATJ ; Alternate method
; to clear output latches
MOVLW 0CFh ; Value used to
; initialize data
; direction
MOVWF TRISJ ; Set RJ3:RJ0 as inputs
; RJ5:RJ4 as output
; RJ7:RJ6 as inputs