7,166
edits
Line 481: | Line 481: | ||
} | } | ||
sei(); | sei(); | ||
</syntaxhighlight> | |||
実測の結果: | |||
<syntaxhighlight lang="c" enclose="div"> | |||
#include <avr/sleep.h> | |||
#ifndef cbi | |||
#define cbi(sfr, bit) (_SFR_BYTE(sfr) &= ~_BV(bit)) | |||
#endif | |||
#ifndef sbi | |||
#define sbi(sfr, bit) (_SFR_BYTE(sfr) |= _BV(bit)) | |||
#endif | |||
... | |||
noInterrupts(); | |||
cbi(ADCSRA, ADEN); | |||
set_sleep_mode(SLEEP_MODE_PWR_DOWN); | |||
sleep_enable(); | |||
sleep_bod_disable(); | |||
interrupts(); | |||
sleep_cpu(); | |||
sleep_disable(); | |||
sbi(ADCSRA, ADEN); | |||
</syntaxhighlight> | </syntaxhighlight> | ||