Sleeps modes or power saving modes present in Atmel are identical to the sleeps modes available in our laptop. Sleeps mode enable the application to shut down unused modules in the µC, thereby saving power. The AVR provides various sleep modes, allowing the user to tailor the power consumption to the application’s requirement. All the sleep modes are available in the
#include<avr/sleep.h>

To enter any of the six sleep modes, the SE bit in the MCUCR must be written to logical 1 and a sleep instruction must be executed. If an enabled interrupt occurs while the MCU in sleep mode, the MCU wakes up. The MCU is than halted for four clock cycles in addition to the start up time; it executes the interrupt routine and resumes execution from the instruction following sleep. The contents of register file and SRAM are unaltered, when the device wakes up from sleep. If a Reset occurs during sleep mode, the MCU wakes up and executes from the Reset vector.
1. Idle mode:-
The sleep instruction makes the MCU enter Idle mode, stopping the CPU but allowing SPI, USART, Analog Comparator, ADC, Two-wire serial Interface, Timers/Counter, Watchdog and the interrupt system to continue operating. Idle modes enables the MCU to wake up from external triggered interrupts as one as internal one like the Timer Overflow and USART Transmit complete interrupts.
2. ADC noise reduction mode:-
The sleep instruction makes the MCU enter ADC noise reduction mode, stopping the MCU but allowing the ADC, the External Interrupts, TWI, Timers/Counter2 and watchdog timer to continue operating. This improves the noise environment for ADC, enabling higher resolution measurement. If the ADC is enabled a conversion starts automatically when this mode is entered.
#include<avr/sleep.h>
MCUCR|=(1<<SE); //Sleep enable
MCUCR|=(1<<SM0); // ADC noise reduction
3. Power-down mode:-
In this mode, the External Oscillator is stopped, while the External interrupts, Two-wire serial interface address watch and the watchdog continue operating (if enable). This sleep mode basically halts all generated clocks, allowing power-down mode. There is a delay from the wake-up condition occurs until the wake-up becomes effective. This allowing the clock to restart and becomes stable after having been stopped.
#include<avr/sleep.h>
MCUCR|=(1<<SE); //Sleep enable
MCUCR|=(1<<SM1); // Power down mode
4. Power-save mode:-
This mode is identical to power down mode, with one exception. If Timers/Counter2 is clocked asynchronously i.e. the AS2 bit in the ASSR is set. Timers/Counter2 will run during sleep. The device can wake-up from either Timer/Counter2, if the corresponding Timers/Counter2 interrupt enable bit are in TIMSK and the Global Interrupt Enable bit in SREG is set.
#include<avr/sleep.h>
MCUCR|=(1<<SE); //Sleep enable
MCUCR|=(1<<SM0)|(1<<SM1); // Power save mode
5. Standby Mode:-
This mode is identical to power-down with the exception that the oscillator is keep running, from standby mode; the device wakes up in six clock cycles.
#include<avr/sleep.h>
MCUCR|=(1<<SE); //Sleep enable
MCUCR|=(1<<SM1)|(1<<SM2); //Standby sleep mode
6. Extended Standby Mode:-
The Extended sleep mode is identical to power save mode with the exception that the oscillator is keep running. From Extended standby mode, the device wakes up in six clock cycles.
#include<avr/sleep.h>
MCUCR|=(1<<SE); //Sleep enable
MCUCR|=(1<<SM0)(1<<SM1)|(1<<SM2); //Extended Standby sleep mode








Visit Today : 42
Total Visit : 28457