12F629 low power and weak pullups

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 4.
To post in this forum you must have a registered copy of Flowcode 4 or higher. To sign up for this forum topic please use the "Online Resources" link in the Flowcode Help Menu.

Moderator: Benj

Post Reply
MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

12F629 low power and weak pullups

Post 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

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: 12F629 low power and weak pullups

Post 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.

MarkW
Flowcode v5 User
Posts: 118
Joined: Thu Sep 17, 2009 1:30 pm
Has thanked: 3 times
Been thanked: 11 times
Contact:

Re: 12F629 low power and weak pullups

Post 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

allpicproject
Flowcode V4 User
Posts: 36
Joined: Thu Sep 01, 2011 11:10 am
Has thanked: 17 times
Been thanked: 1 time
Contact:

Re: 12F629 low power and weak pullups

Post 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

Post Reply