I am trying to understand how to program avr in event-based model, where it reacts to what is going around it.
After reading my chip (ATmega16a) manual and googling I still can't find exact answer to my question.
Both avr-libc manuals I found http://www.atmel.com/webdoc/AVRLibcReferenceManual/group__avr__sleep.html and http://www.nongnu.org/avr-libc/user-manual/group__avr__sleep.html insist on that it is recommended to enable sleep mode (set SE bit) right before entering sleep and disable it afterwards (by clearing SE). What purpose serves this bit-shuffling? Why can't I just enable sleep mode once at the reset and then freely enter it by just executing 'sleep' instruction where it is needed?
You can just enable sleep mode once at the reset and then freely enter sleep.
By clearing the SE bit you can prevent sleeping in situations when you need.