To operate the RTC, follow these steps:
- 1.Configure the RTC-internal prescaler by
writing the PRESCALER bit field in the Control A register (RTC.CTRLA).
- 2.Set the Compare value in the Compare
register (RTC.CMP), and/or the Overflow value in the Top register (RTC.PER).
- 3.Enable the desired Interrupts by writing
to the respective Interrupt Enable bits (CMP, OVF) in the Interrupt Control register
(RTC.INTCTRL).
- 4.Enable the RTC by writing a '1' to the
RTC Enable bit (RTCEN) in the Control A register (RTC.CTRLA).
Note: The RTC peripheral is
used internally during device start-up. Always check the Busy bits in
the RTC.STATUS and RTC.PITSTATUS registers, also on initial
configuration.