Is there a way to enable weak pullups on selected port B pins?
Specifically I would like to have a weak pull up on RB1 (pin22) only of a 16F877A.
Thanks.
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Thu Sep 27, 2007 11:40 am
The data sheet says this:
Quote:
Each of the PORTB pins has a weak internal pull-up.
A single control bit can turn on all the pull-ups.
This is performed by clearing bit RBPU (OPTION_REG<7>).
The weak pull-up is automatically turned off when the
port pin is configured as an output. The pull-ups are
disabled on a Power-on Reset.
Cuffy
Joined: 27 Sep 2007 Posts: 2
Pullups on individual port B pins
Posted: Thu Sep 27, 2007 11:54 am
Thanks for the quick reply. I did see that in the spec. I am hoping that somewhere out there lies a clever solution.
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
Posted: Thu Sep 27, 2007 1:27 pm
PCM programmer wrote:
The data sheet says this:
Quote:
Each of the PORTB pins has a weak internal pull-up.
A single control bit can turn on all the pull-ups.
This is performed by clearing bit RBPU (OPTION_REG<7>).
The weak pull-up is automatically turned off when the
port pin is configured as an output. The pull-ups are
disabled on a Power-on Reset.
Does that imply you could turn on pull-ups for the port, and then turn off all but RB1 by making those pins temporarily outputs? It might be worth a try. If it works please let us know, and comment your code thoroughly so you will know what you were doing a few years down the road! _________________ The search for better is endless. Instead simply find very good and get the job done.
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Thu Sep 27, 2007 1:42 pm
Code:
Does that imply you could turn on pull-ups for the port, and then turn off all but RB1 by making those pins temporarily outputs
No. If you make the pin into an output and then put it back to an input
the pull-up will be enabled again. There is no trick way to fool the
PIC. It works as stated in the data sheet.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum