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 CCS Technical Support

Weak Pull-Ups on a 16F684 [solved]

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



Joined: 01 Sep 2008
Posts: 19
Location: Earth / Europe / Germany

View user's profile Send private message

Weak Pull-Ups on a 16F684 [solved]
PostPosted: Fri May 01, 2009 12:15 am     Reply with quote

Hi Folks,

on a 16F684 I want to use the weak pull-ups on A4 and A5 (A0 to A3 are analog inputs).
A HW check shows that they are turned off, adding 1 Meg to Vdd proved the HW to be working.

What I did in SW is to use:
Code:
port_a_pullups (0b00110000);


or

Code:

#define OPTION 0x81
#define WPUA   0x95

...

*OPTION |= 0b10000000;                          // Enable weak pull-ups for ports A
*WPUA = 0b00110000;                             // Set weak pull-ups for port A5, A4


Simulating the below code WPUA and OPTION are set correctly but the HW is still not working as expected.

Any ideas?
_________________
Never check your brain at the door!


Last edited by /dev/human on Sun May 03, 2009 4:06 am; edited 1 time in total
RLScott



Joined: 10 Jul 2007
Posts: 465

View user's profile Send private message

Re: Weak Pull-Ups on a 16F684
PostPosted: Fri May 01, 2009 4:57 am     Reply with quote

Have you configured A4 and A5 as digital inputs? (in which case you should probably call them by their port pin names rather than A4 and A5) The weak pull-up will not work if they are still left at their default configuration as analog inputs.
_________________
Robert Scott
Real-Time Specialties
Embedded Systems Consulting
/dev/human



Joined: 01 Sep 2008
Posts: 19
Location: Earth / Europe / Germany

View user's profile Send private message

PostPosted: Fri May 01, 2009 10:58 am     Reply with quote

Yes RA3 to RA5 are digital inputs. I'm aware the RA3 needs an external pull-up. I checked the code and the result with MPLAB. According MPLAB the SFR ANSEL is 0b00000111. WPUA is 0b00110111, OPTION is 0b11000001. This is all I can think of to enable weak pull-ups. Checking the input signals with a scope, I can only see correct signals (open collector driver) when at least 1 M or better 100 k is attached externally.

Man, I'm stupid, while re-reading the entry, I recognize I need to clear -RAPU.

Addendum: and yes, it works! Very Happy
_________________
Never check your brain at the door!
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