//Clock frequency stepping via XDIV and sleep //R. Traylor 11.16.09 /* *This code demonstrates the effect on power consumption of *not having pullups turned on. Also, the code steps through *a reduction of operating frequency by using the XDIV register *to show the power savings of reducing the clock frequency. * *After stepping down to 0.5Mhz, the processor goes to sleep. *(AVR power down mode) The processor sleeps until awakened *by a falling edge interrupt on INT0. Then the processor blinks *PORTB.0 LED to indicate its awake again. */ #define F_CPU 16000000UL //16Mhz clock //note: effective F_CPU changes as the code executes #include #include #include #include //**************************** INT0_vect ISR ******************************** ISR(INT0_vect){ XDIV &= ~(1<