How to enable Internal pullup Resistors in flocode

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
DanDMan
Posts: 11
Joined: Wed Jul 15, 2009 8:28 pm

How to enable Internal pullup Resistors in flocode

Post by DanDMan »

I need the internal pullup resistors enabled on some pins. How do I enable them from flowcode?

..or do I need to do that in C? If so what is the C code that enables them (16f616 chip)

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: How to enable Internal pullup Resistors in flocode

Post by Benj »

Hello

You enable the PortA pull ups by using the following line of C code.

set_bit( option_reg, 7 );

Note that PortA pullups are only available on pins RA0, RA1, RA2, RA4 and RA5.

I think there is also a way to enable individual pull ups if you didn't want them all enabled.

To do this use the following line of C code.

set_bit( wpua, x );

Where x is the PortA pin you wish to assign the pull up to. Eg 0, 1, 2, 4 or 5.

DanDMan
Posts: 11
Joined: Wed Jul 15, 2009 8:28 pm

Re: How to enable Internal pullup Resistors in flocode

Post by DanDMan »

perfect! thanks!

Post Reply