CESARDOLO / narcoleptic

Automatically exported from code.google.com/p/narcoleptic
0 stars 0 forks source link

improvement suggestion: switch AD converter off #2

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Very comfortable library. It would be possible to save a little more power, 
even if AD converter would be switched off.

# ifndef cbi
# define cbi (sfr, bit) (_SFR_BYTE (sfr) & = ~ _BV (bit))
# endif
# ifndef sbi
# define sbi (sfr, bit) (_SFR_BYTE (sfr) | = _BV (bit))
# endif

[...]

NarcolepticClass :: void delay (int milliseconds) {
   cbi (ADCSRA, ADEN);
  [...]
   sbi (ADCSRA, ADEN);
}

Original issue reported on code.google.com by schulz.m...@googlemail.com on 14 Jul 2013 at 8:08

GoogleCodeExporter commented 8 years ago
Narcoleptic uses "power_down" sleep, there are no ADC working at MCU depending 
to datasheet (doc8271.pdf) section 9.1, page 39. So it doesn't worth to try 
disable/enable ADC.

Original comment by erdem...@gmail.com on 18 Oct 2013 at 11:14

GoogleCodeExporter commented 8 years ago
I interpret the table differently. The ADC will not automatically turn off with 
Power_Down mode, it just can not be used to wake up the MCU.
My measurements show also that after the shutdown of the ADC power consumption 
will be decreased.
I test other power-saving libraries that ADC also explicitly turn off and 
obtain a low consumption. I've written about it on my site, but in German 
(http://s6z.de/cms/index.php/arduino/nuetzliches/9-winterschlaf-fuer-arduino).

Sorry for my terrible English.

Original comment by schulz.m...@googlemail.com on 18 Oct 2013 at 10:27