Pages: [1]   Go Down
Author Topic: RTC_library for Due Problems with Alarm and Interrupts  (Read 560 times)
0 Members and 1 Guest are viewing this topic.
Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
#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:
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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!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

At this moment I have no idea about this.

Hope someone can help me.

* rtc_clock.cpp (6.84 KB - downloaded 20 times.)
* rtc_clock.h (1.29 KB - downloaded 5 times.)
Logged

Germany
Offline Offline
Full Member
***
Karma: 10
Posts: 221
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmmm,

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

Code:
RTC_EnableIt(RTC, RTC_IER_SECEN);

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

 smiley-yell
Logged

Pages: [1]   Go Up
Jump to: