PIC18F2420/2520/4420/4520
TABLE 10-3: PORTB I/O SUMMARY
TRIS
Setting
I/O
Pin
Function
I/O
Description
Type
RB0/INT0/FLT0/
AN12
RB0
0
1
O
I
DIG
TTL
LATB<0> data output; not affected by analog input.
PORTB<0> data input; weak pull-up when RBPU bit is cleared.
(1)
Disabled when analog input enabled.
INT0
FLT0
AN12
RB1
1
1
1
0
1
I
I
ST
ST
External interrupt 0 input.
Enhanced PWM Fault input (ECCP1 module); enabled in software.
(1)
I
ANA
DIG
TTL
A/D input channel 12.
RB1/INT1/AN10
RB2/INT2/AN8
RB3/AN9/CCP2
O
I
LATB<1> data output; not affected by analog input.
PORTB<1> data input; weak pull-up when RBPU bit is cleared.
Disabled when analog input enabled.
(1)
INT1
AN10
RB2
1
1
0
1
I
I
ST
ANA
DIG
TTL
External Interrupt 1 input.
(1)
A/D input channel 10.
O
I
LATB<2> data output; not affected by analog input.
PORTB<2> data input; weak pull-up when RBPU bit is cleared.
Disabled when analog input enabled.
(1)
INT2
AN8
RB3
1
1
0
1
I
I
ST
ANA
DIG
TTL
External interrupt 2 input.
(1)
A/D input channel 8.
O
I
LATB<3> data output; not affected by analog input.
PORTB<3> data input; weak pull-up when RBPU bit is cleared.
Disabled when analog input enabled.
(1)
(1)
AN9
1
0
1
0
1
I
O
I
ANA
DIG
ST
A/D input channel 9.
(2)
CCP2
CCP2 compare and PWM output.
CCP2 capture input
RB4/KBI0/AN11
RB5/KBI1/PGM
RB4
O
I
DIG
TTL
LATB<4> data output; not affected by analog input.
PORTB<4> data input; weak pull-up when RBPU bit is cleared.
Disabled when analog input enabled.
(1)
KBI0
AN11
RB5
1
1
0
1
1
x
I
I
TTL
ANA
DIG
TTL
TTL
ST
Interrupt-on-pin change.
(1)
A/D input channel 11.
O
I
LATB<5> data output.
PORTB<5> data input; weak pull-up when RBPU bit is cleared.
Interrupt-on-pin change.
KBI1
PGM
I
I
Single-Supply In-Circuit Serial Programming™ mode entry (ICSP™).
Enabled by LVP Configuration bit; all other pin functions disabled.
RB6/KBI2/PGC
RB7/KBI3/PGD
RB6
0
1
1
x
0
1
1
x
x
O
I
DIG
TTL
TTL
ST
LATB<6> data output.
PORTB<6> data input; weak pull-up when RBPU bit is cleared.
Interrupt-on-pin change.
KBI2
PGC
RB7
I
(3)
I
Serial execution (ICSP) clock input for ICSP and ICD operation.
O
I
DIG
TTL
TTL
DIG
ST
LATB<7> data output.
PORTB<7> data input; weak pull-up when RBPU bit is cleared.
Interrupt-on-pin change.
KBI3
PGD
I
(3)
O
I
Serial execution data output for ICSP and ICD operation.
(3)
Serial execution data input for ICSP and ICD operation.
Legend:
DIG = Digital level output; TTL = TTL input buffer; ST = Schmitt Trigger input buffer; ANA = Analog level input/output;
x= Don’t care (TRIS bit does not affect port direction or is overridden for this option).
Note 1: Configuration on POR is determined by the PBADEN Configuration bit. Pins are configured as analog inputs by default
when PBADEN is set and digital inputs when PBADEN is cleared.
2: Alternate assignment for CCP2 when the CCP2MX Configuration bit is ‘0’. Default assignment is RC1.
3: All other pin functions are disabled when ICSP or ICD are enabled.
© 2008 Microchip Technology Inc.
DS39631E-page 109