Dependencies:   PCF8563 RTC8563 mbed

Files at this revision

API Documentation at this revision

Comitter:
04M04
Date:
Fri Apr 01 10:50:55 2016 +0000
Commit message:

Changed in this revision

PCF8563.lib Show annotated file Show diff for this revision Revisions of this file
RTC8563.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/PCF8563.lib	Fri Apr 01 10:50:55 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/Ladner-Schmied/code/PCF8563/#d7f120bcedd7
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RTC8563.lib	Fri Apr 01 10:50:55 2016 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/Ladner-Schmied/code/RTC8563/#5335182295f2
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Apr 01 10:50:55 2016 +0000
@@ -0,0 +1,44 @@
+#include "mbed.h"
+#include "const.h"
+#include "PCF8563.h"
+#include "string"
+ 
+Serial pc(USBTX, USBRX);
+//I2C i2c(p28, p27);
+ 
+uint8_t year, month, day, week;
+uint8_t hour, minute, sec;
+char week_chr[7][4] = {"MON","TUE","WED","THU","FRI","SAT","SUN"};
+ 
+int main()
+{
+    PCF8563 rtc;  // instanziieren des Objektes rtc
+ 
+    pc.printf("Setting up RTC\n\r");
+    //rtc.rtc_init();
+ 
+    while(1) {
+        //printTime();           
+        year = rtc.read(YEARS);   // Aufruf der Methode rtc_read der Instanz (Objekt) rtc
+        month = rtc.read(MONTHS);
+        day = rtc.read(DAYS);
+        week = rtc.read(WEEKDAYS);
+        hour = rtc.read(HOURS);
+        minute = rtc.read(MINUTES);
+        sec = rtc.read(SECONDS);
+ 
+        //Datum Ausgabe
+        pc.printf("20%x%x/%x%x/%x%x %s\n\r",
+                  ((year >> 4) & 0x03) , (year & 0x0F) ,
+                  ((month >> 4) & 0x01), (month & 0x0F) ,
+                  ((day >> 4) & 0x03), (day & 0x0F) ,
+                  week_chr[week & 0x07]);
+ 
+        //Zeit Ausgabe
+        pc.printf("%x%x:%x%x:%x%x\n\r",
+                  ((hour >> 4) & 0x03), (hour & 0x0F),
+                  (minute >> 4), (minute & 0x0F) ,
+                  (sec >> 4), (sec & 0x0F) );
+        wait(1);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Fri Apr 01 10:50:55 2016 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/87f2f5183dfb
\ No newline at end of file