Skip to content

RTC prescaler | Attiny816 #1113

Answered by hmeijdam
ASDosjani asked this question in Q&A
Jun 12, 2024 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

I never use the sleep function, but you can prescale the RTC to trigger an interrupt for example once in a couple of hours

The PIT can only do once every 32 seconds max, but the RTC_CNT interrupt can be set for hours. In below example I set the RTC to use the 1KHz clock signal and then count to 1000. Without prescaling that takes one second. In the example I prescale with 64, so it takes 64 seconds between a RTC_CNT interrupt to occur. Visualizeing by toggling a led on PB0.

If you set it to RTC_CTRLA |= RTC_PRESCALER_DIV32768_gc | RTC_RTCEN_bm; // turn on RTC ansd set RTC prescaler factor It is going to take 32768 seconds, which is a little over 9 hours.

If that's still not enough, you in…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
2 replies
@ASDosjani
Comment options

@hmeijdam
Comment options

Answer selected by ASDosjani
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants