English
Language : 

PIC18F14K22LIN Datasheet, PDF (19/62 Pages) Microchip Technology – 20-Pin Flash Microcontrollers 20-Pin Flash Microcontrollers
3.0 I/O PORTS
3.1 PORTB, TRISB and LATB
Registers
PORTB is a 4-bit wide, bidirectional port. It functions
the same as described in the “PIC18F1XK22/LF1XK22
Data Sheet” (DS41365) with the following differences.
Three bits are dedicated to the LIN transceiver. No pins
are associated with this function. Only RB4 is available
on a pin. The corresponding data direction register is
TRISB. The TRISB bits must be set as ‘001x 0000’.
The PORTB Data Latch register (LATB) is also memory
mapped. Read-modify-write operations on the LATB
register read and write the latched output value for
PORTB.
PIC18F14K22LIN
EXAMPLE 3-1: INITIALIZING PORTB
MOVLW
MOVWF
CLRF
MOVLW
MOVWF
0C0h
PORTB
LATB
030h
TRISB
; set RB6 and RB7
; high
; Initialize PORTB by
; clearing output
; data latches
; Alternate method
; to clear output
; data latches
; Value used to
; initialize data
; direction
; Set RB<7:6> as outputs
; and RB<5:4> as inputs
.
Note:
On a Power-on Reset, RB<5:4> are
configured as analog inputs by default and
read as ‘0’.
REGISTER 3-1: PORTB: PORTB REGISTER
R/W-x
R/W-x
R/W-x
R/W-x
U-0
U-0
U-0
U-0
LINTX
LINCS
LINRX
RB4
—
—
—
—
bit 7
bit 0
Legend:
R = Readable bit
-n = Value at POR
W = Writable bit
‘1’ = Bit is set
U = Unimplemented bit, read as ‘0’
‘0’ = Bit is cleared
x = Bit is unknown
bit 7
bit 6
bit 5
bit 4
bit 3-0
LINTX: Dedicated to the LIN Transceiver Transmit Function
LINCS: Dedicated to the LIN Transceiver Chip Select Function
LINRX: Dedicated to the LIN Transceiver Receive Function
RB4: PORTB I/O Pin bit
1 = Port pin is >VIH
0 = Port pin is <VIL
Unimplemented: Read as ‘0’
 2011 Microchip Technology Inc.
Preliminary
DS41580A-page 23