RTC

Dependencies:   DS1307 RTC_sync mbed

Files at this revision

API Documentation at this revision

Comitter:
stijn4495
Date:
Tue Mar 24 08:31:30 2015 +0000
Commit message:
RTC

Changed in this revision

DS1307.lib Show annotated file Show diff for this revision Revisions of this file
RTC_synchroniseren.cpp Show annotated file Show diff for this revision Revisions of this file
TextLCD.lib 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
diff -r 000000000000 -r 172604dcaa46 DS1307.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DS1307.lib	Tue Mar 24 08:31:30 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/harrypowers/code/DS1307/#c3e4da8feb10
diff -r 000000000000 -r 172604dcaa46 RTC_synchroniseren.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/RTC_synchroniseren.cpp	Tue Mar 24 08:31:30 2015 +0000
@@ -0,0 +1,59 @@
+ #include "ds1307.h"
+ #include "TextLCD.h"
+ #include "mbed.h"
+ 
+ Serial pc(USBTX, USBRX); // tx, rx  for debug and usb pc comunications
+ TextLCD lcd(p15, p16, p17, p18, p19, p20, TextLCD::LCD20x4); // rs, e, d4-d7
+ DS1307 DS1307(p9,p10); // start DS1307 class and give it pins for connections of the DS1307 device
+
+ int sec = 0;       // Values to set time withppppppppppppp
+ int min = 20;
+ int hours = 13;
+ int day = 2;
+ int date = 23;
+ int month = 3;
+ int year = 15;
+ int prevSec = 0;
+
+ int main() {  
+ //gebruik onderstaande enkel om de RTC juist te zetten
+ DS1307.settime( sec, min, hours, day, date, month, year);    // Set the time on the DS1307
+     
+      DS1307.gettime( &sec, &min, &hours, &day, &date, &month, &year);  // Read the time and display on screen
+      pc.printf("seconds read are %.2D \n\r",sec);
+      pc.printf("min read are %.2D \n\r",min);
+      pc.printf("hour read are %.2D \n\r",hours);
+      pc.printf("day read are %.2D \n\r",day);
+      pc.printf("date read are %.2D \n\r",date);
+      pc.printf("month read are %.2D \n\r",month);
+      pc.printf("year read are %.2D \n\r",year);
+     
+     while (1){        // Loop continously
+        DS1307.gettime( &sec, &min, &hours, &day, &date, &month, &year);
+        
+        /*if (day == 1)
+            lcd.printf("   Sunday \n");
+        if (day == 2)
+            lcd.printf("   Monday \n");   
+        if (day == 3)
+            lcd.printf("   Tuesday \n");
+        if (day == 4)
+            lcd.printf("   Wednesday \n");
+        if (day == 5)
+            lcd.printf("   Thursday \n");
+        if (day == 6)
+            lcd.printf("   Friday \n");
+        if (day == 7)
+            lcd.printf("   Saturday \n");*/
+            
+        if (sec != prevSec){
+            pc.printf("seconds read are %.2D \n\r",sec);
+            pc.printf("min read are %.2D \n\r",min);
+            pc.printf("hour read are %.2D \n\r",hours);
+            pc.printf("day read are %.2D \n\r",day);
+            pc.printf("date read are %.2D \n\r",date);
+            pc.printf("month read are %.2D \n\r",month);
+            pc.printf("year read are %.2D \n\r",year);
+            prevSec = sec;}
+    }          
+ }
\ No newline at end of file
diff -r 000000000000 -r 172604dcaa46 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Tue Mar 24 08:31:30 2015 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/users/stijn4495/code/RTC_sync/#927b194e4aaf
diff -r 000000000000 -r 172604dcaa46 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Mar 24 08:31:30 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/4fc01daae5a5
\ No newline at end of file