Page 1 of 1

PIC 12F629 gpio internal pull-up/down settings

Posted: Thu Jun 16, 2022 9:34 am
by mansiukit
Hi, I have a difficulty to set the code of gpio internal pull-up/down settings. Anyone can teach me how to set the code? Thank a lot!

Re: PIC 12F629 gpio internal pull-up/down settings

Posted: Thu Jun 16, 2022 9:41 am
by BenR
Hello,

The PIC12F629 only has internal pull up resistors but these can be enabled as follows using a C icon.

Code: Select all

OPTION_REG = OPTION_REG & 0x7F;  //Clear GPPU bit enabling pull ups
WPU = 0x11;  //Enable Pullup on GPIO0 & GPIO4 

Re: PIC 12F629 gpio internal pull-up/down settings

Posted: Thu Jun 16, 2022 10:21 am
by mansiukit
BenR wrote:
Thu Jun 16, 2022 9:41 am
Hello,

The PIC12F629 only has internal pull up resistors but these can be enabled as follows using a C icon.

Code: Select all

OPTION_REG = OPTION_REG & 0x7F;  //Clear GPPU bit enabling pull ups
WPU = 0x11;  //Enable Pullup on GPIO0 & GPIO4 
Is it correct? The internal pull up resistors of IOPort 4 is still disable.
Thanks.

Image

Re: PIC 12F629 gpio internal pull-up/down settings

Posted: Thu Jun 16, 2022 10:46 am
by BenR
Hello,

You have the C code in between the /* and */ symbols, these are comment blocks and need removing otherwise the code is effectively commented out.

Re: PIC 12F629 gpio internal pull-up/down settings

Posted: Thu Jun 16, 2022 11:23 am
by mansiukit
BenR wrote:
Thu Jun 16, 2022 10:46 am
Hello,

You have the C code in between the /* and */ symbols, these are comment blocks and need removing otherwise the code is effectively commented out.
Thank you so much