
PIC18CXX8
DS30475A-page 106
Advanced Information
2000 Microchip Technology Inc.
8.9
PORTJ, LATJ, and TRISJ Registers
PORTJ is an 8-bit wide, bi-directional port available
only on the PIC18C858 devices. The corresponding
Data Direction register is TRISJ. Setting a TRISJ bit
(=1) will make the corresponding PORTJ pin an input
(i.e., put the corresponding output driver in a
hi-impedance mode). Clearing a TRISJ bit (=0) will
make the corresponding PORTJ pin an output (i.e., put
the contents of the output latch on the selected pin).
Read-modify-write operations on the LATJ register
read and write the latched output value for PORTJ.
PORTJ on the PIC18C858 is an 8-bit port with Schmitt
Trigger input buffers. Each pin is individually config-
urable as an input or output.
EXAMPLE 8-9:
INITIALIZING PORTJ
FIGURE 8-18: PORTJ BLOCK DIAGRAM
Note:
This port is available on PIC18C858.
CLRF
PORTJ
; Initialize PORTJ by
; clearing output
; data latches
CLRF
LATJ
; Alternate method
; to clear output
; data latches
MOVLW
0xCF
; Value used to
; initialize data
; direction
MOVWF
TRISJ
; Set RJ3:RJ0 as inputs
; RJ5:RJ4 as outputs
; RJ7:RJ6 as inputs
Data Bus
WR LATJ
WR TRISJ
Data Latch
TRIS Latch
RD TRISJ
Q
D
Q
CK
QD
EN
Q
D
Q
CK
P
N
VDD
VSS
RD PORTJ
I/O Pin
or
WR PORTJ
RD LATJ
Schmitt
Trigger
Note:
I/O pins have diode protection to VDD and VSS.