Page 1 of 1

18F252 Internal pull-up

Posted: Tue Oct 07, 2014 7:35 am
by bercioiu
I need to activate for the 18F252 internal pull-up and I cant handle...
I put a C code icon with the "intcon2 = 0;" but it activate INT1 at the RB!.
How can I clear only the RBPU (bit7) of the INTCON2 register?
I tried with "clear_bit(intcon2 , 7);" to but the result was the same: All port B is "up", but RB1 is low...

Re: 18F252 Internal pull-up

Posted: Tue Oct 07, 2014 9:45 am
by Benj
Hello,

To enable the weak pull up on that pin you need to clear bit 7 of intcon2 and also set the bit of the tris register to convert the pin into an input.

Code: Select all

clear_bit(intcon2 , 7);
set_bit(trisb, 1);

Re: 18F252 Internal pull-up

Posted: Tue Oct 07, 2014 2:05 pm
by bercioiu
I need to enable weak pull up for all bytes of the port B, thank you!

Re: 18F252 Internal pull-up

Posted: Tue Oct 07, 2014 2:47 pm
by Benj
Ok this code should work.

Code: Select all

clear_bit(intcon2 , 7);
trisb = 0xFF;

Re: 18F252 Internal pull-up

Posted: Tue Oct 07, 2014 3:01 pm
by bercioiu
The same situation... RB1 is low :-(
This is the schematic: