// Timer2 DIV 32
TCCR2B = (0 << CS22) | (1 << CS21) | (1 << CS20);
// Overflow interrupt enable
TIMSK2 = (1 << TOIE2);
// Interrupts on
sei();
while
(1)
{
// If deep sleep, then power down
if
(deep_sleep)
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
else
{
// Shorter sleep in idle with LED on
TCNT2 = 0;
set_sleep_mode(SLEEP_MODE_IDLE);
}
sleep_mode();
}
}
To do:
•
Build the project/solution (F7)
•
Program the application into the target device using Start Without Debugging (Ctrl+Alt+F5)
•
Switch to Data Visualizer to see the results
Important: Because the previous example prescaled the clock to 8 MHz/64, the ISP programming clock
must be set to less than 32 kHz to be below 1/4 of the main clock.
Important: Remember to disable on-board power on the Xplained Mini.
©
2020 Microchip Technology Inc.
User Guide
Power Debugger
Detailed Use Cases
DS40002201A-page 23
Need help?
Do you have a question about the Power Debugger and is the answer not in the manual?