CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Pullups on individual port B pins

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
Cuffy



Joined: 27 Sep 2007
Posts: 2

View user's profile Send private message

Pullups on individual port B pins
PostPosted: Thu Sep 27, 2007 11:32 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Sep 27, 2007 11:40 am     Reply with quote

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

View user's profile Send private message

Pullups on individual port B pins
PostPosted: Thu Sep 27, 2007 11:54 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Sep 27, 2007 1:27 pm     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Sep 27, 2007 1:42 pm     Reply with quote

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.
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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


Powered by phpBB © 2001, 2005 phpBB Group