Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

PIC 18F1320 very strange RB2 port problem

Status
Not open for further replies.

Dextratech

Newbie level 2
Joined
May 21, 2009
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,300
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;



Any help or advice greatly appreciated.
JB
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top