AVR Libc Home Page | AVR Libc Development Pages | ||||
Main Page | User Manual | Library Reference | FAQ | Alphabetical Index | Example Projects |
#include <avr/power.h>
多くにAVRILは、電力削減レジスタ(PRR)やレジスタ群(PRRx)を持っている。これにより、必要とするオンボード周辺回路を許可や不許可することで、消費電力を削減することができる。
電力削減のために、オンボード周辺回路の許可や不許可の簡単なインターフェースを提供する多くのマクロがヘッダファイルに含まれています。下のテーブルを参照ください。
電力マクロ | 説明 | 使用できるデバイス |
power_adc_enable() | アナログデジタルコンバータモジュールを有効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, ATmega165, ATmega165P, ATmega325, ATmega325A, ATmega3250, ATmega3250A, ATmega645, ATmega6450, ATmega169, ATmega169P, ATmega329, ATmega329A, ATmega3290, ATmega3290A, ATmega649, ATmega6490, ATmega164P, ATmega324P, ATmega644, ATmega48, ATmega88, ATmega168, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861 |
power_adc_disable() | アナログデジタルコンバータモジュールを無効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, ATmega165, ATmega165P, ATmega325, ATmega325A, ATmega3250, ATmega3250A, ATmega645, ATmega6450, ATmega169, ATmega169P, ATmega329, ATmega329A, ATmega3290, ATmega3290A, ATmega649, ATmega6490, ATmega164P, ATmega324P, ATmega644, ATmega48, ATmega88, ATmega168, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861 |
power_lcd_enable() | LCDモジュールを有効 | ATmega169, ATmega169P, ATmega329, ATmega329A, ATmega3290, ATmega3290A, ATmega649, ATmega6490 |
power_lcd_disable(). | LCDモジュールを無効 | ATmega169, ATmega169P, ATmega329, ATmega329A, ATmega3290, ATmega3290A, ATmega649, ATmega6490 |
power_pscr_enable() | Power Stage Controller モジュールを有効 | AT90PWM81 |
power_pscr_disable() | Power Stage Controller モジュールを無効 | AT90PWM81 |
power_psc0_enable() | Power Stage Controller 0 モジュールを有効 | AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B |
power_psc0_disable() | Power Stage Controller 0 モジュールを無効 | AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B |
power_psc1_enable() | Power Stage Controller 1 モジュールを有効 | AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B |
power_psc1_disable() | Power Stage Controller 1 モジュールを無効 | AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B |
power_psc2_enable() | Power Stage Controller 1 モジュールを有効 | AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM81 |
power_psc2_disable() | Power Stage Controller 2 モジュールを無効 | AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM81 |
power_spi_enable() | シリアルペリフェラルインタフェース(SPI)を有効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, ATmega165, ATmega165P, ATmega325, ATmega325A, ATmega3250, ATmega3250A, ATmega645, ATmega6450, ATmega169, ATmega169P, ATmega329, ATmega329A, ATmega3290, ATmega3290A, ATmega649, ATmega6490, ATmega164P, ATmega324P, ATmega644, ATmega48, ATmega88, ATmega168 |
power_spi_disable() | >シリアルペリフェラルインタフェース(SPI)を無効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, ATmega165, ATmega165P, ATmega325, ATmega325A, ATmega3250, ATmega3250A, ATmega645, ATmega6450, ATmega169, ATmega169P, ATmega329, ATmega329A, ATmega3290, ATmega3290A, ATmega649, ATmega6490, ATmega164P, ATmega324P, ATmega644, ATmega48, ATmega88, ATmega168 |
power_timer0_enable() | Timer 0 モジュールを有効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, AT90PWM1, AT90PWM216, AT90PWM316, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, ATmega165, ATmega165P, ATmega325, ATmega325A, ATmega3250, ATmega3250A, ATmega645, ATmega6450, ATmega164P, ATmega324P, ATmega644, ATmega406, ATmega48, ATmega88, ATmega168, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861 |
power_timer0_disable() | Timer 0 モジュールを無効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, ATmega165, ATmega165P, ATmega325, ATmega325A, ATmega3250, ATmega3250A, ATmega645, ATmega6450, ATmega164P, ATmega324P, ATmega644, ATmega406, ATmega48, ATmega88, ATmega168, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861 |
power_timer1_enable() | Timer 1 モジュールを有効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, ATmega165, ATmega165P, ATmega325, ATmega325A, ATmega3250, ATmega3250A, ATmega645, ATmega6450, ATmega169, ATmega169P, ATmega329, ATmega329A, ATmega3290, ATmega3290A, ATmega649, ATmega6490, ATmega164P, ATmega324P, ATmega644, ATmega406, ATmega48, ATmega88, ATmega168, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861 |
power_timer1_disable() | Timer 1 モジュールを無効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, AT90PWM81, ATmega165, ATmega165P, ATmega325, ATmega325A, ATmega3250, ATmega3250A, ATmega645, ATmega6450, ATmega169, ATmega169P, ATmega329, ATmega329A, ATmega3290, ATmega3290A, ATmega649, ATmega6490, ATmega164P, ATmega324P, ATmega644, ATmega406, ATmega48, ATmega88, ATmega168, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861 |
power_timer2_enable() | Timer 2 モジュールを有効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATmega164P, ATmega324P, ATmega644, ATmega48, ATmega88, ATmega168 |
power_timer2_disable() | Timer 2 モジュールを無効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATmega164P, ATmega324P, ATmega644, ATmega48, ATmega88, ATmega168 |
power_timer3_enable() | Timer 3 モジュールを有効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287 |
power_timer3_disable() | Timer 3 モジュールを無効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287 |
power_timer4_enable() | Timer 4 モジュールを有効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561 |
power_timer4_disable() | Timer 4 モジュールを無効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561 |
power_timer5_enable() | Timer 5 モジュールを有効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561 |
power_timer5_disable() | Timer 5 モジュールを無効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561 |
power_twi_enable() | 2線インタフェース(TWI)を有効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATmega164P, ATmega324P, ATmega644, ATmega406, ATmega48, ATmega88, ATmega168 |
power_twi_disable() | 2線インタフェース(TWI)を無効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATmega164P, ATmega324P, ATmega644, ATmega406, ATmega48, ATmega88, ATmega168 |
power_usart_enable() | USART モジュールを有効 | AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B |
power_usart_disable() | USART モジュールを無効 | AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B |
power_usart0_enable() | USART 0 モジュールを有効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, ATmega165, ATmega165P, ATmega325, ATmega325A, ATmega3250, ATmega3250A, ATmega645, ATmega6450, ATmega169, ATmega169P, ATmega329, ATmega329A, ATmega3290, ATmega3290A, ATmega649, ATmega6490, ATmega164P, ATmega324P, ATmega644, ATmega48, ATmega88, ATmega168 |
power_usart0_disable() | USART 0 モジュールを無効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, ATmega165, ATmega165P, ATmega325, ATmega325A, ATmega3250, ATmega3250A, ATmega645, ATmega6450, ATmega169, ATmega169P, ATmega329, ATmega329A, ATmega3290, ATmega3290A, ATmega649, ATmega6490, ATmega164P, ATmega324P, ATmega644, ATmega48, ATmega88, ATmega168 |
power_usart1_enable() | USART 1 モジュールを有効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATmega164P, ATmega324P, ATmega644 |
power_usart1_disable() | USART 1 モジュールを無効 | ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, ATmega164P, ATmega324P, ATmega644 |
power_usart2_enable() | USART 2 モジュールを有効 | ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561 |
power_usart2_disable() | USART 2 モジュールを無効 | ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561 |
power_usart3_enable() | USART 3 モジュールを有効 | ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561 |
power_usart3_disable() | USART 3 モジュールを無効 | ATmega640, ATmega1280, ATmega1281, ATmega2560, ATmega2561 |
power_usb_enable() | USB モジュールを有効 | AT90USB646, AT90USB647, AT90USB1286, AT90USB1287 |
power_usb_disable() | USB モジュールを無効 | AT90USB646, AT90USB647, AT90USB1286, AT90USB1287 |
power_usi_enable() | ユニバーサルシリアルインターフェース(USI)を有効 | ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861 |
power_usi_disable() | ユニバーサルシリアルインターフェース(USI)を無効 | ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861 |
power_vadc_enable() | 電圧ADCモジュールを有効 | ATmega406 |
power_vadc_disable() | 電圧ADCモジュールを無効 | ATmega406 |
power_all_enable() | 全てのモジュールを有効 | ATxmega6A4, ATxmega32A4, ATxmega64A1, ATxmega64A1U, ATxmega64A3, ATxmegaA1, ATxmegaA1U, ATxmega128A3, ATxmega192A3, ATxmega256A3, ATxmegaA3B, ATxmega16D4, ATxmega32D4, ATxmega64D3, ATxmega128D3, ATxmega192D3, ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, ATmega165, ATmega165P, ATmega325, ATmega325A, ATmega3250, ATmega325A, ATmega645, ATmega6450, ATmega169, ATmega169P, ATmega329, ATmega329A, ATmega3290, ATmega3290A, ATmega649, ATmega6490, ATmega164P, ATmega324P, ATmega644, ATmega406, ATmega48, ATmega88, ATmega168, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861 |
power_all_disable() | 全てのモジュールを無効 | ATxmega6A4, ATxmega32A4, ATxmega64A1, ATxmega64A1U, ATxmega64A3, ATxmegaA1, ATxmegaA1U, ATxmega128A3, ATxmega192A3, ATxmega256A3, ATxmegaA3B, ATxmega16D4, ATxmega32D4, ATxmega64D3, ATxmega128D3,ATxmega192D3, ATmega640, ATmega1280, ATmega1281, ATmega128RFA1, ATmega2560, ATmega2561, AT90USB646, AT90USB647, AT90USB1286, AT90USB1287, AT90PWM1, AT90PWM2, AT90PWM2B, AT90PWM3, AT90PWM3B, AT90PWM216, AT90PWM316, ATmega165, ATmega165P, ATmega325, ATmega325A, ATmega3250, ATmega325A, ATmega645, ATmega6450, ATmega169, ATmega169P, ATmega329, ATmega329A, ATmega3290, ATmega3290A, ATmega649, ATmega6490, ATmega164P, ATmega324P, ATmega644, ATmega406, ATmega48, ATmega88, ATmega168, ATtiny24, ATtiny44, ATtiny84, ATtiny84A, ATtiny25, ATtiny45, ATtiny85, ATtiny261, ATtiny461, ATtiny861 |
より新しいAVRのいくつかは、計算力の必要性が低いときに、システムクロック周波数と消費電力を下げることが出来るよう、システムクロックプリスケーラレジスタ(CLKPR)を持っている。クロックプリスケーラレジスタに使用するインタフェースは、下の二つのマクロと列挙体である。
typedef enum { clock_div_1 = 0, clock_div_2 = 1, clock_div_4 = 2, clock_div_8 = 3, clock_div_16 = 4, clock_div_32 = 5, clock_div_64 = 6, clock_div_128 = 7, clock_div_256 = 8, clock_div_1_rc = 15, // ATmega128RFA1 only } clock_div_t;
クロックプリスケーラ設定列挙体
clock_prescale_set(x)
システムクロックの分周期設定を選択し、クロックプリスケーラレジスタへ設定する。この関数は、たとえコンパイラ最適化が不可能であってもインライン化される。
xの型は、clock_div_tである。
clock_prescale_get()
クロックプリスケーラー・レジスターの設定を得て、返す。戻り型は、clock_div_tである。