Running the same code in PDIP and QFN versions of PIC18F1320 we see 6 of a batch of 12 QFN versions failing because RB2 is permanently low when being used for digital I/O, even when disconnected from the circuit with weak pull-ups enabled. All the others work fine with the same code.
Please advise whether I have a code configuration error or if this is a known issue.
I am trying to use RB2 for digital I/O, but do not need CCP/PWM or A2D for my application although I am using INT on change for RB5.
Config code follows....
// config bits set as follows... // _INTIO2_OSC_1H _BORV_20_2l _BOR_OFF_2L _PWRT_ON_2L _WDT_OFF_2H _MCLRE_ON_3H // _BKBUG_OFF_4L _LVP_OFF_4L _STVR_OFF_4L
OSCCON=0x7F; // 8 MHz Fosc = 2 MHz execution (0.5us/cycle) T0CON =0xC8; T1CON=0; T2CON=0; T3CON=0; TMR0L=16; // (256-0) * 0.5us = 128us per interrupt
RCON.IPEN=0; // disable interrupt priority support INTCON=0x00; // Disable ints INTCON2=0x00; // PORTB weak pull-ups enabled INTCON3=0x00; INTCON.TMR0IE=1; INTCON.RBIE=1; INTCON.GIE=1; // enable interrupts RCSTA=0; // disable euart CCP1CON=0; // disable CCP1
ADCON0=0x00; // All pins digital ADCON1=0x7F; // Disable all A2D
PORTA=0; TRISA = 0x30; PORTB=0; TRISB = 0xE0;
?Many thanks for any help or advice.
JB