English
Language : 

PIC16F1829LIN Datasheet, PDF (40/74 Pages) Micon Design Technology Corporation – 20-Pin, 8-bit Flash LIN/J2602 Microcontroller
PIC16F1829LIN
5.2 PORTB Registers
PORTB is a 4-bit wide, bidirectional port. It functions the
same as described in the “PIC16(L)F1825/1829 Data
Sheet” (DS41440) 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.
EXAMPLE 5-1: INITIALIZING PORTB
banksel PORTB
MOVLW 0C0h
MOVWF PORTB
banksel LATB
CLRF LATB
banksel TRISB
MOVLW 030h
MOVWF TRISB
; set LINCS and LINTX
; 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’.
5.2.1 ANSELB REGISTER
The ANSELB register (Register 5-6) is used to
configure the Input mode of an I/O pin to analog.
Setting the appropriate ANSELB bit high will cause all
digital reads on the pin to be read as ‘0’ and allow
analog functions on the pin to operate correctly.
The state of the ANSELB bits has no effect on digital
output functions. A pin with TRIS clear and ANSELB set
will still operate as a digital output, but the Input mode
will be analog. This can cause unexpected behavior
when executing READ-MODIFY-WRITE instructions on
the affected port.
Note:
The ANSELB bits default to the Analog
mode after Reset. To use any pins as
digital general purpose or peripheral
inputs, the corresponding ANSEL bits
must be initialized to ‘0’ by user software.
DS41673A-page 40
Preliminary
 2012 Microchip Technology Inc.