Enable weak-pulls 12F675

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 2 and 3.

Moderators: Benj, Mods

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

Enable weak-pulls 12F675

Post by medelec35 »

what is c code to enable weak-pull ups in option register, without changing any other bits of register.
I believe its a shift left command with a 1 and amount of places required i.e
option_reg (1<<7) or somthing like that
or is it best to mask unwanted changes i.e
option_reg = option_reg & 0b01111111
please bear in mind, my C knowledge is as weak as the pic pullups :lol:
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: Enable weak-pulls 12F675

Post by Benj »

Hello

The easiest option is probabl;y to use the set_bit funtion.

Here is some example code where 7 is the bit number of the register. Bits of registers are numbered 0 - 7.

set_bit(option_reg, 7);

If you wished to clear a bit then here is the function.

clear_bit(RegisterName, BitName Or BitNumber);

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

Re: Enable weak-pulls 12F675

Post by medelec35 »

Thanks Ben,
That is a nice way of alterting option reg.
Martin

Post Reply