This example shows how to switch between various system clock sources and prescalers at run time.
All AVR UC3A, UC3A1 and UC3B devices can be used.
The clock system is reconfigured every time the user presses a button (NEXT_BUTTON) to use the next clock source and prescaler settings shown in the state diagram below.
A Timer/Counter (TC) is used to generate periodic interrupts based on its peripheral bus clock. With each interrupt, a LED (LED_EXAMPLE_OUTPUT) is toggled, thus giving a visual indication of the system clock frequency.
This software was written for the GNU GCC and IAR for AVR. Other compilers may or may not work.
For further information, visit Microchip.