18F252 Internal pull-up

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 5.
To post in this forum you must have a registered copy of Flowcode 5 or higher.

Moderator: Benj

Post Reply
bercioiu
Posts: 161
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Has thanked: 90 times
Been thanked: 34 times
Contact:

18F252 Internal pull-up

Post 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...
Attachments
18F252.pdf
(3.14 MiB) Downloaded 235 times

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 18F252 Internal pull-up

Post 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);

bercioiu
Posts: 161
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Has thanked: 90 times
Been thanked: 34 times
Contact:

Re: 18F252 Internal pull-up

Post by bercioiu »

I need to enable weak pull up for all bytes of the port B, thank you!

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: 18F252 Internal pull-up

Post by Benj »

Ok this code should work.

Code: Select all

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

bercioiu
Posts: 161
Joined: Sun Feb 25, 2007 10:56 am
Location: bucharest, romania
Has thanked: 90 times
Been thanked: 34 times
Contact:

Re: 18F252 Internal pull-up

Post by bercioiu »

The same situation... RB1 is low :-(
This is the schematic:
Attachments
rb1.gif
(68.79 KiB) Downloaded 979 times

Post Reply