8.7.3 sleep_cpu Macro

Put the device to sleep.

Include

<avr/sleep.h>

Prototype

void sleep_cpu(void);

Remarks

This macro puts the device to sleep. The sleep enable bit must be set beforehand for the device to sleep.

Example

#include <xc.h>
#include <avr/sleep.h>
int main(void)
{
  cli();
  if (some_condition)
  {
    sleep_enable();
    sei();
    sleep_cpu();
    sleep_disable();
  }
  sei();
}