enabling weak pull up

For questions and comments on programming in general. And for any items that don't fit into the forums below.

Moderators: Benj, Mods

Post Reply
JUZAR
Posts: 53
Joined: Wed Feb 25, 2015 1:31 pm
Has thanked: 15 times
Been thanked: 4 times
Contact:

enabling weak pull up

Post by JUZAR »

in PIC12F615, kindly advise how to enable single port pin GP3 as weak pull up.

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: enabling weak pull up

Post by medelec35 »

You will need to use a C code block.
The C code will have to be in lower or upper case depending on your version of Flowcode.
What is your version of Flowcode?
Martin

User avatar
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: enabling weak pull up

Post by Benj »

Hello,

In the device datasheet there is this in the notes regarding the weak pullups.
1: Global GPPU must be enabled for individual pull-ups to be enabled.
3:The GP3 pull-up is enabled when configured as MCLR in the Configuration Word, otherwise it is disabled as an input and reads as ‘0’.
Not sure if this means GP3 weak pullup is only on when the global GPPU bit is set or on anyway but the C code to set the GPPU bit would look like this.

Flowcode 6 and previous

Code: Select all

option_reg = option_reg | 0x80;
Flowcode 7 and after

Code: Select all

OPTION_REGbits.GPPU = 1;

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: enabling weak pull up

Post by medelec35 »

Hi Ben,
As it's

Code: Select all

NOT GPPU
I thought GPPU has to be cleared for WPU to be enabled?
Benj wrote:OPTION_REGbits.GPPU = 1;
causes an errror:

Code: Select all

12F615 Weak pull ups .c: main()
    77:	OPTION_REGbits.GPPU = 1;
	                    ^ (255) not a member of the struct/union ""
	                       ^ (182) illegal conversion between types
int -> volatile union S50
(908) exit status = 1
As it's NOT GPPU it should be:

Code: Select all

OPTION_REGbits.nGPPU = 1;
I don't believe GP3 has a weak pull-up that works?
All the other pins do.
Martin

User avatar
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: enabling weak pull up

Post by Benj »

Aha yes I missed the line, negating the operation :wink:

Thanks for checking :D

Post Reply