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...
18F252 Internal pull-up
Moderator: Benj
- 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
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.
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);
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
- 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
Ok this code should work.
Code: Select all
clear_bit(intcon2 , 7);
trisb = 0xFF;
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel