Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Thread

sleep mode in mega16

sleep mode in mega16

2004-04-05 by jay marante

Hi!
I want to put the mega16 in a power-save mode but i cant get it done. anu sample C codes? i want it so badly coz my system comsumes so much power from the 9V battery. i think it wont even last a day.
thanks.
-jay

Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway - Enter today

Re: [AVR-Chat] sleep mode in mega16

2004-04-05 by David VanHorn

At 06:56 AM 4/5/2004 -0700, jay marante wrote:

>Hi!
> 
>I want to put the mega16 in a power-save mode but i cant get it done. anu sample C codes? i want it so badly coz my system comsumes so much power from the 9V battery. i think it wont even last a day.


First off, how are you doing your voltage regulation?
When moderate currents are flowing, switchers are more efficient.
When the current is very small, linear regs win.


On sleeping, you need to set your external I/O up to the appropriate states (only you can figure that) and then worry about the processor.

Turning off timers that you don't need, shutting down analog ref and A/D. In the M128, you can program the Xdiv register to slow the clock down quite a lot.  In all the megas, you can program the CKOPT fuse to use the Vittoz oscillator, but you'd better do some careful design there, to avoid problems.

Of course you need a mechanism to come out of low power mode, like an interrupt, or ... ?

Re: [AVR-Chat] sleep mode in mega16

2004-04-05 by jay marante

im using max883 as a linear regulator. its output is about 200-250mA of current. 
 
how will i code the power-save mode in ICCAVR?
 
thanks.
 
-jay

David VanHorn <dvanhorn@cedar.net> wrote:
At 06:56 AM 4/5/2004 -0700, jay marante wrote:

>Hi!
> 
>I want to put the mega16 in a power-save mode but i cant get it done. anu sample C codes? i want it so badly coz my system comsumes so much power from the 9V battery. i think it wont even last a day.


First off, how are you doing your voltage regulation?
When moderate currents are flowing, switchers are more efficient.
When the current is very small, linear regs win.


On sleeping, you need to set your external I/O up to the appropriate states (only you can figure that) and then worry about the processor.

Turning off timers that you don't need, shutting down analog ref and A/D. In the M128, you can program the Xdiv register to slow the clock down quite a lot.  In all the megas, you can program the CKOPT fuse to use the Vittoz oscillator, but you'd better do some careful design there, to avoid problems.

Of course you need a mechanism to come out of low power mode, like an interrupt, or ... ?



---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/AVR-Chat/
  
   To unsubscribe from this group, send an email to:
AVR-Chat-unsubscribe@yahoogroups.com
  
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 



---------------------------------
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway - Enter today

Re: [AVR-Chat] sleep mode in mega16

2004-04-05 by David VanHorn

At 07:37 AM 4/5/2004 -0700, jay marante wrote:

>im using max883 as a linear regulator. its output is about 200-250mA of current. 

Your system draws that much?  If so, you seriously need a switcher.
The linear is wasting about 40% of the power available, and a switcher will not be more than 10%, and could reach 2% for an ideal design.

>how will i code the power-save mode in ICCAVR?

Complicated subject.

You have to determine how to configure the I/O ports so that the external stuff draws as little power as possible, then set the ports up that way.

You'll also have to pay attention to sequencing as you go to sleep, and as you wake up agian. There may be things in your externals that need to be done in a certain order to avoid damage, or large power draw.

In the chip, it's "simply" a matter of shutting off peripherals you aren't using, lowering clock speeds to minimum, and activating sleep.
The sleep instruction has to be preceeded by a sleep enable.

If course you also have to provide a wakeup mechanism.

It's not a simple thing.

Can you describe the system in more detail?

RE: [AVR-Chat] sleep mode in mega16

2004-04-05 by LightYearCS

Just wanted to add to this.  In this day and age, most if not almost all
switching regulators will win out over linear types.

One exception is the LDO linear regulator but then you need to have your
input voltage to be very close to your output voltage for there to be
any real efficiency.

I've done extensive research on DC-DC converters, mostly converting from
3.6 volts to 5 volts.  The parts I'm using are 96% efficient.

Some amazing stuff out there.

Barry
Show quoted textHide quoted text
-----Original Message-----
From: David VanHorn [mailto:dvanhorn@cedar.net] 
Sent: Monday, April 05, 2004 7:17 AM
Subject: Re: [AVR-Chat] sleep mode in mega16

At 06:56 AM 4/5/2004 -0700, jay marante wrote:

>Hi!
> 
>I want to put the mega16 in a power-save mode but i cant get it done.
anu sample C codes? i want it so badly coz my system comsumes so much
power from the 9V battery. i think it wont even last a day.

First off, how are you doing your voltage regulation?
When moderate currents are flowing, switchers are more efficient.
When the current is very small, linear regs win.

On sleeping, you need to set your external I/O up to the appropriate
states (only you can figure that) and then worry about the processor.

Turning off timers that you don't need, shutting down analog ref and
A/D. In the M128, you can program the Xdiv register to slow the clock
down quite a lot.  In all the megas, you can program the CKOPT fuse to
use the Vittoz oscillator, but you'd better do some careful design
there, to avoid problems.

Of course you need a mechanism to come out of low power mode, like an
interrupt, or ... ?

 
Yahoo! Groups Links

RE: [AVR-Chat] sleep mode in mega16

2004-04-05 by LightYearCS

Yeah yeah like David said...

Look for a "dc-dc buck converter."  Check out Texas Instruments.  They
have an excellent sample policy and you can get samples right on line.
You can get more samples if you call in.

Typically, you can get 5 online or 20 (max) if you call in.  Don't abuse
the privilege please, I rely on this sampling service and would be upset
if policy changed.
Show quoted textHide quoted text
-----Original Message-----
From: David VanHorn [mailto:dvanhorn@cedar.net] 
Sent: Monday, April 05, 2004 8:11 AM
Subject: Re: [AVR-Chat] sleep mode in mega16

At 07:37 AM 4/5/2004 -0700, jay marante wrote:

>im using max883 as a linear regulator. its output is about 200-250mA of
current. 

Your system draws that much?  If so, you seriously need a switcher.
The linear is wasting about 40% of the power available, and a switcher
will not be more than 10%, and could reach 2% for an ideal design.

>how will i code the power-save mode in ICCAVR?

Complicated subject.

You have to determine how to configure the I/O ports so that the
external stuff draws as little power as possible, then set the ports up
that way.

You'll also have to pay attention to sequencing as you go to sleep, and
as you wake up agian. There may be things in your externals that need to
be done in a certain order to avoid damage, or large power draw.

In the chip, it's "simply" a matter of shutting off peripherals you
aren't using, lowering clock speeds to minimum, and activating sleep.
The sleep instruction has to be preceeded by a sleep enable.

If course you also have to provide a wakeup mechanism.

It's not a simple thing.

Can you describe the system in more detail?


 
Yahoo! Groups Links

RE: [AVR-Chat] sleep mode in mega16

2004-04-05 by Larry Barello

The mega16 in max power mode consumes only 40ma.  Simply putting it into
IDLE mode between interrupts will drop the consumption to 5 or so ma.  If
you circuit is drawing 250ma then the vast bulk of the current draw is from
something OTHER than the CPU.

Read about the sleep modes in the data sheet.  You set two bits in the MCUCR
and then execute the "sleep" instruction.  Interrupts will bring you out of
the sleep.  Turning off peripherals (Analog comparator, ADC) will save you
about 1ma max, if even that.
Show quoted textHide quoted text
-----Original Message-----
From: jay marante [mailto:jaythesis@yahoo.com]
Sent: Monday, April 05, 2004 7:38 AM
To: AVR-Chat@yahoogroups.com
Subject: Re: [AVR-Chat] sleep mode in mega16


im using max883 as a linear regulator. its output is about 200-250mA of
current.

how will i code the power-save mode in ICCAVR?

thanks.

-jay

David VanHorn <dvanhorn@cedar.net> wrote:
  At 06:56 AM 4/5/2004 -0700, jay marante wrote:

  >Hi!
  >
  >I want to put the mega16 in a power-save mode but i cant get it done. anu
sample C codes? i want it so badly coz my system comsumes so much power from
the 9V battery. i think it wont even last a day.


  First off, how are you doing your voltage regulation?
  When moderate currents are flowing, switchers are more efficient.
  When the current is very small, linear regs win.


  On sleeping, you need to set your external I/O up to the appropriate
states (only you can figure that) and then worry about the processor.

  Turning off timers that you don't need, shutting down analog ref and A/D.
In the M128, you can program the Xdiv register to slow the clock down quite
a lot.  In all the megas, you can program the CKOPT fuse to use the Vittoz
oscillator, but you'd better do some careful design there, to avoid
problems.

  Of course you need a mechanism to come out of low power mode, like an
interrupt, or ... ?




----------------------------------------------------------------------------
----
Do you Yahoo!?
Yahoo! Small Business $15K Web Design Giveaway - Enter today

----------------------------------------------------------------------------
----
Yahoo! Groups Links

  a.. To visit your group on the web, go to:
  http://groups.yahoo.com/group/AVR-Chat/

  b.. To unsubscribe from this group, send an email to:
  AVR-Chat-unsubscribe@yahoogroups.com

  c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.

Re: sleep mode in mega16

2004-04-05 by Phil

If you really are pulling 250 mA with a simple design and a linear 
Vreg, make sure you have a 0.1uF bypass cap between the V input and 
ground as called out on the datasheet.  Its easy enough to overlook 
when putting something together.  
 
At 250mA your vreg should be very hot or have a mondo heatsink.  

--- In AVR-Chat@yahoogroups.com, "Larry Barello" <yahoo@b...> wrote:
> The mega16 in max power mode consumes only 40ma.  Simply putting it 
into
> IDLE mode between interrupts will drop the consumption to 5 or so 
ma.  If
> you circuit is drawing 250ma then the vast bulk of the current draw 
is from
> something OTHER than the CPU.
> 
> Read about the sleep modes in the data sheet.  You set two bits in 
the MCUCR
> and then execute the "sleep" instruction.  Interrupts will bring 
you out of
> the sleep.  Turning off peripherals (Analog comparator, ADC) will 
save you
> about 1ma max, if even that.
> 
> 
> -----Original Message-----
> From: jay marante [mailto:jaythesis@y...]
> Sent: Monday, April 05, 2004 7:38 AM
> To: AVR-Chat@yahoogroups.com
> Subject: Re: [AVR-Chat] sleep mode in mega16
> 
> 
> im using max883 as a linear regulator. its output is about 200-
250mA of
> current.
> 
> how will i code the power-save mode in ICCAVR?
> 
> thanks.
> 
> -jay
> 
> David VanHorn <dvanhorn@c...> wrote:
>   At 06:56 AM 4/5/2004 -0700, jay marante wrote:
> 
>   >Hi!
>   >
>   >I want to put the mega16 in a power-save mode but i cant get it 
done. anu
> sample C codes? i want it so badly coz my system comsumes so much 
power from
> the 9V battery. i think it wont even last a day.
> 
> 
>   First off, how are you doing your voltage regulation?
>   When moderate currents are flowing, switchers are more efficient.
>   When the current is very small, linear regs win.
> 
> 
>   On sleeping, you need to set your external I/O up to the 
appropriate
> states (only you can figure that) and then worry about the 
processor.
> 
>   Turning off timers that you don't need, shutting down analog ref 
and A/D.
> In the M128, you can program the Xdiv register to slow the clock 
down quite
> a lot.  In all the megas, you can program the CKOPT fuse to use the 
Vittoz
> oscillator, but you'd better do some careful design there, to avoid
> problems.
> 
>   Of course you need a mechanism to come out of low power mode, 
like an
> interrupt, or ... ?
> 
> 
> 
> 
> --------------------------------------------------------------------
--------
> ----
> Do you Yahoo!?
> Yahoo! Small Business $15K Web Design Giveaway - Enter today
> 
> --------------------------------------------------------------------
--------
> ----
> Yahoo! Groups Links
> 
>   a.. To visit your group on the web, go to:
>   http://groups.yahoo.com/group/AVR-Chat/
> 
>   b.. To unsubscribe from this group, send an email to:
>   AVR-Chat-unsubscribe@yahoogroups.com
> 
>   c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of 
Service.

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.