+/* Enable a periodic interrupt. At each clock count a interrupt is triggered
+ * and consequently the handler is invoked. */
+static void periodic_intr() {
+
+ while(!rchkbit(RTC_CRL, 5)); // Check last write is terminated
+ rsetbit(RTC_CRL, 4); // start configure
+ rsetbit(RTC_CRH, 0); // enable periodic (second) interrupt
+
+ while(!rchkbit(RTC_CRL, 5));
+ rwrite(RTC_PRLL, 0x7FFF); // 0x7FFF equals 1 second clock configuration
+ rclrbit(RTC_CRL, 4); // stop configure
+ while(!rchkbit(RTC_CRL, 5)); // Check last write is terminated
+ rsetbit(NVIC_ISER0, 3); // enable in register vector
+}
+
+/* Setup the Real time clock to work with the Low speed external
+ * chrystal (32.768 kHz) */