Introduction

Author: Victor Berzan, Microchip Technology Inc.

This technical brief describes how the Real-Time Counter (RTC) module works on tinyAVR® 0- and 1-series, megaAVR® 0-series and AVR® DA devices. It covers the following use cases:

  • RTC Overflow Interrupt:

    Initialize the RTC, enable the overflow interrupt, and toggle an LED on each overflow.

  • RTC Periodic Interrupt:

    Initialize the RTC PIT, enable the periodic interrupt, and toggle an LED on each periodic interrupt.

  • RTC PIT Wake from Sleep:

    Initialize the RTC PIT, enable the periodic interrupt, configure device sleep mode, put CPU in Sleep, the PIT interrupt will wake the CPU.

Note: For each use case described in this document, there are two code examples: One bare metal developed on ATmega4809, and one generated with MPLAB® Code Configurator (MCC) developed on AVR128DA48.