Page 1 of 1

12F629 low power and weak pullups

Posted: Tue Oct 25, 2011 8:47 am
by MarkW
Hi Ben etc....

Working on a small project using the 12F629 in low power application and have few questions,
project requires input/int and 0.5s pulse output....running on 3.2V battery.

1. What is considered the best low power mode? I am currently 32khz @ 3.2V. Datasheet
sez at 2V (close to 3.2V) using 32khz xtal draws about 8uA. Is this best for starters?

2. For the input i need to monitor an open drain from the equipment (pull up needed to 3.2V).
Questions is, if i make RB2/INT my input, and setup as interrupt, does FC automatically
enable weak pullup on that pin? Or does that need to be manually set? (i prefer not external
pullup resistor outside the chip). The datasheet says to set option and wpu(weak pullup), to
enable internal weak pullup on a specified pin. If need to be manually set what is the c icon
commands for that? Is it an asm routine needed?

3. i need a delay to generate 0.5s pulse, however when using the delay icon setting that delay
figure, i get a compiler error about the delay function. No matter what value/base i set i get
the error (delay inaccurate). I did not trust that so i created inner/outer loop to get rough
delay. Any reason why i get the error? The delay is not very short...so there should be more than
time to do a delay on 32khz?

4. so to save max power, is the interrupt event driven scheme better since the processor is idle
most of the time....the other method of polling the input for change requires more power
since the processor is constantly active?

Thanx for any input!

Mark

Re: 12F629 low power and weak pullups

Posted: Tue Oct 25, 2011 12:32 pm
by Benj
Hello Mark,

In answer to your questions.

1) Yes this sounds good for a start. If you have down time eg delays in your program then you could also work in a sleep function which would bring the average current usage down further.

2) Weak pullup resistor will be off by default. You will have to enable this by using a C code icon and writing to the correct register.

option_reg = option_reg & 0x7F; //Enable Weak Pullups
wpu = wpu | 0x04; //Enable Pullup on GPIO2

3) Delay error is probably caused by your slow clock speed and the compiler being unable to divide the clock frequency down to the correct number of steps. I think this is simply a warning that your delays might be ever so slightly longer then expected rather then an error.

4) As I said in step 1 it should be possible to put the device to sleep and use a INT or a timer interrupt to bring the device back out of sleep mode.

Re: 12F629 low power and weak pullups

Posted: Wed Oct 26, 2011 1:14 pm
by MarkW
Hi Ben

thanx for the feedback. All working as planned now...good idea about the sleep mode!
Forgot about that trick :)

Thanx

Mark

Re: 12F629 low power and weak pullups

Posted: Thu Oct 27, 2011 5:04 am
by allpicproject
MarkW wrote:Hi Ben

thanx for the feedback. All working as planned now...good idea about the sleep mode!
Forgot about that trick :)

Thanx

Mark
Hi Mark,

if possible, can you share over here the flowcode file ?

Sound interesting to me.

Tqvm