View previous topic :: View next topic |
Author |
Message |
/dev/human
Joined: 01 Sep 2008 Posts: 19 Location: Earth / Europe / Germany
|
Weak Pull-Ups on a 16F684 [solved] |
Posted: Fri May 01, 2009 12:15 am |
|
|
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
|
Re: Weak Pull-Ups on a 16F684 |
Posted: Fri May 01, 2009 4:57 am |
|
|
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
|
|
Posted: Fri May 01, 2009 10:58 am |
|
|
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! _________________ Never check your brain at the door! |
|
|
|