RTC question

Go To Last Post
7 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

I'm using RTC on Atmega4808 with this settings

 

	RTC.CTRLA = RTC_PRESCALER_DIV1_gc   /* 1 */
	            | 1 << RTC_RTCEN_bp     /* Enable: enabled */
	            | 0 << RTC_RUNSTDBY_bp; /* Run In Standby: disabled */

	RTC.CLKSEL = RTC_CLKSEL_INT1K_gc; /* 32KHz divided by 32 */

	RTC.INTCTRL = 0 << RTC_CMP_bp    /* Compare Match Interrupt enable: disabled */
	              | 1 << RTC_OVF_bp; /* Overflow Interrupt enable: enabled */

 

The OVF ISR will be called in each 1 ms or in each 65.535s? So with this setup PER=0. RTC will increment CNT at first or will check CNT and call ISR?

 

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

Refer to this as you are just showing the initialization and part of your code, I cant see where to start.

 

This documentation might help you to get through RTC with OVF interrupt.

http://ww1.microchip.com/downloa...

 

some hints:

- you have to make CCP in order to control the CLK, otherwise your settings will net get through, how to do this ? refer to the datasheet CCP part. try to work around, otherwise post a complete code and show what you really want to do, then you might get some help,

 

regards

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

 

My question is about the RTC module.

 

What does this module when PER=0 (period)?

 

When RTC gets the clock can do the following (two scenario)

 

1. Increments CNT. When CNT reaches PER it calls the ISR (assume it is enabled) and sets CNT to 0. In this scenario the ISR will be called at each 65536 clock (because PER is a16bit register).

2. CNT == PER? Yes, because CNT=0 at start and PER=0. In this scenario ISR will be called (CNT will set to 0) at each clock

 

What is the correct?

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

Moe123 wrote:
otherwise post a complete code and show what you really want to do, then you might get some help,

What if the OP does not want to show his complete code?

 

 

FF = PI > S.E.T

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The complete code is too big.

I'm studying the 

 

http://start.atmel.com/#examples...

AVR IOT WG sensor Node.

 

timeout.c file

 

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 1

ki0bk wrote:

Moe123 wrote:

otherwise post a complete code and show what you really want to do, then you might get some help,

 

What if the OP does not want to show his complete code?

 

 

Freaks never ask for complete code, just a small complete program that demos the problem, often performing this request the OP will discover his own answer.

 

PS: nice catch, ;)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Attention: RTC (Interrupts) using internal 32 kHz oscillator must not be initialized too early because then this oscillator maybe not ready yet.