Why do you want to put your microcontroller keep running when it is doing nothing ? It's just waste of power to keep microcontroller running even it is doing nothing . This sleep property of microcontroller is just like your computer goes to sleep after certain period of time if you are doing nothing with your computer . The power management in embedded design is major challenge , scientists are still trying to find the alternative source of power that will long last . Sleeping microcontroller while it is doing nothing is best method of reduction of power . look above circuit is stopped blinking it goes to sleep ( do not believe me ? try to reload this page and see ). How to wake up then ?? you will learn soon .
There are six mode of sleep : Idle, ADC Noise Reduction, Power-save, Power-down, Standby and Extended Standby .
in above example power down mode to save power consumption . The CPU goes to sleep fore-ever after five times blinking the LED . How do you wake up the microcontroller from sleep mode ? Sorry you cannot wake up CPU from sleep . What ? micrcontroller is dead ? The answer is no , microcontroller is just lazy to sleep for long time . You will need to pour the water from the microcontroller head . Yes , you will need interrupt to wake up microcontroller from sleep . Without external interrupt you cannot wake up . Now let's add interrupt header file and trigger interrupt to INTO pin . (if you do not know what interrupt means on microcontroller just visit this page https://www.electronify.org/learn-microcontrolleravr/interrupts .
I am again telling you that if you do not have habit of reading datasheet please make habbit . Each and every operation of this process is explained in data sheet of atmega16 If you do not have data sheet please download from this link doc2466_ATMEGA_16 go to page number 32 and there you will find power management and sleep mode please read these carefully . mainly MCUCR register . Because each mode is selected in this register eithere you wanna power down mode or ideal mode or what-ever .
Sorry i did not explained everything things here but if you . I preferred you datasheet of atmega 16 for detail information . You can add additional lines of code inside interrupt service routine . here is just another example . But i hope you already understood everything , if you did not understood please leave a comment below , i will try to explain everything .
IF you found this useful please share this with your friends