Go Down

Topic: RTC_library for Due Problems with Alarm and Interrupts (Read 875 times) previous topic - next topic

Markus_L811

Hi,

I stuck in some Problem with the work on the Due RTC lib there is my code and the output my Problem is I get an interrupt at the wrong time and then infinity of them:

Sketch
Code: [Select]
#include <rtc_clock.h>

// Select the Slowclock source
//RTC_clock rtc_clock(RC);
RTC_clock rtc_clock(XTAL);

void setup() {
 Serial.begin(9600);
 rtc_clock.init();
 rtc_clock.set_time(23, 59, 50);
//  rtc_clock.settime(14, 57, 50);
 rtc_clock.set_date(13, 11, 2011);
 rtc_clock.set_alarmtime(23, 59, 57);
 rtc_clock.attachalarm(snuzze);
}

int x = 0;

void loop() {
 Serial.print("At the third stroke, it will be ");
 Serial.print(rtc_clock.get_hours());
 Serial.print(":");
 Serial.print(rtc_clock.get_minutes());
 Serial.print(":");
 Serial.println(rtc_clock.get_seconds());
 Serial.print(rtc_clock.get_days());
 Serial.print(".");
 Serial.print(rtc_clock.get_months());
 Serial.print(".");
 Serial.println(rtc_clock.get_years());
 Serial.println(rtc_clock.get_day_of_week());
//  if (x == 100) {
//    rtc_clock.set_years(2012);
//  }
//  x++;
}

void snuzze() {
 Serial.println("#################################");
}


The Output
Code: [Select]
At the third stroke, it will be 23:59:51
13.11.2011
7
At the third stroke, it will be 23:59:51
13.11.2011
7
At the third stroke, it will be 23:59:51
13.11.2011
7
At the third stroke, it will be 23:59:51
13.11.2011
7
At the third stroke, it will be 23:59:51
13.11.2011
7
At the third stroke, it will be 23:59:51
13.11.2011
7
At the third stroke, it will be 23:59:51
13.11.2011
7
At the third stroke, it will be 23:59:51
13.11.2011
7
At the third stroke, it will be 23:59:51
13.11.2011
7
At the third stroke, it will be 23:59:51
13.11.2011
7
At the third stroke, it will be 23:59:51
13.11.2011
7
At the third stroke, it will be 23:59:51
13.11.2011
7
At the third stroke, it will be 23:59:52
13.11.2011
7
At the third stroke, it will be 23:59:52
13.11.2011
7
At the third stroke, it will be 23:59:52
13.11.2011
7
At t!!!!!!!!!!!!!!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!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


At this moment I have no idea about this.

Hope someone can help me.

Markus_L811

Hmmm,

seems like a fixed for this is deactivating the seconds interrupt.

Code: [Select]
RTC_EnableIt(RTC, RTC_IER_SECEN);

In this situation its enough if I didn't activate it.

:smiley-yell:

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy