|
|
View previous topic :: View next topic |
Author |
Message |
MkAd Guest
|
Low energy consumption |
Posted: Tue Oct 16, 2007 3:26 am |
|
|
Hi:
I'm new in programing with C, and I need to program a clock with timers. I read about this in the forum and I'm ok. With #INT_TIMER1 I have a clock. But I have a problem: I need to power the application with battery, then I need a very low energy consumption. I think to Sleep the Pic, but then TMR1 is stopped. How I can do it??
MkAd |
|
|
Ttelmah Guest
|
|
Posted: Tue Oct 16, 2007 4:36 am |
|
|
The fine details, depend on what chip is involved. However in general, Timer1, can be run from the system clock, or another source. What you do, is set the timer up, to run from a slow external crystal (typically 32768Hz, which is a standard 'watch' crystal). This can then stay running while the processor switches off. At this low frequency, the power consumption is tiny. Typically under 3uA, for the processor 'asleep', and the timer oscillator running - actual numbers will depend on the chip involved, but this is a 'real' figure for a fairly typical 'mid range' 18F chip at 3v.
You need to spend quite a bit of care, to ensure that consumption of other parts is as low as possible (which way lines should be left, ensure 'inputs', are not allowed to 'float' etc.).
Then at this sort of consumption, if you wake up (say) half a dozen times a minute, for a couple of hundred machine instructions, drawing perhaps 2mA, for 40uSec, the 'average' consumption becomes:
3uA + 0.002*40E-6*6 = 3.48uA.
Off (say), a typical lithium cell (CR2032, nominally 180mA/Hr), you then have a battery life, of over 50000Hrs. Typically in excess of 5 years.
The key is, keeping the consumption as low as possible in the 'off' periods, and ensuring these are as long as possible relative to the 'on' periods.
Best Wishes |
|
|
MkAd Guest
|
|
Posted: Tue Oct 16, 2007 8:51 am |
|
|
Thanks Ttelmah:
I'm working with a 16F946. I see the datasheet, and the tmr1 must be in asynchronous counter mode. This is T1CON.2=1 and T1CON.1=1. But I don't know where the external oscillator is. I can put this oscillator of 32k in RA6/OSC2-RA7/OSC1??
MkAd |
|
|
Ttelmah Guest
|
|
Posted: Tue Oct 16, 2007 9:32 am |
|
|
The pins used are OSC1, and OSC2. RA6, and RA7.
SETUP_TIMER1(T1_EXTERNAL | T1_CLK_OUT);
Just use a 32KHz watch crystal between the pins, with a suitable pair of capacitors (normally about 27pF will depend on the crystal specs, but these should work), to ground from the two pins.
Best Wishes |
|
|
MkAd Guest
|
|
Posted: Tue Oct 16, 2007 9:51 am |
|
|
thank you very much.
Now is running very fine.
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|