RTC project

Dependencies:   DS1307 TextLCD mbed

Files at this revision

API Documentation at this revision

Comitter:
RubenHendriks
Date:
Thu Nov 27 10:29:01 2014 +0000
Commit message:
RTC project

Changed in this revision

DS1307.lib 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
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
diff -r 000000000000 -r a1b3b73a7312 DS1307.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DS1307.lib	Thu Nov 27 10:29:01 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/harrypowers/code/DS1307/#c3e4da8feb10
diff -r 000000000000 -r a1b3b73a7312 TextLCD.lib
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TextLCD.lib	Thu Nov 27 10:29:01 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/simon/code/TextLCD/#308d188a2d3a
diff -r 000000000000 -r a1b3b73a7312 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Thu Nov 27 10:29:01 2014 +0000
@@ -0,0 +1,39 @@
+// show how the DS1307 class works
+ #include "ds1307.h"
+ #include "mbed.h"
+ #include "TextLCD.h"
+ 
+ DS1307 my1307(p9,p10); // start DS1307 class and give it pins for connections of the DS1307 device
+ TextLCD lcd(p21,p22,p23,p24,p25,p26);
+ 
+ int sec;
+ int min;
+ int hours;
+ int day;
+ int date;
+ int month;
+ int year;
+ 
+ void test_rw(int test) {
+} 
+ 
+ int main() {
+     int junk = 0;
+ 
+while(1){
+     wait(0.5);
+
+     test_rw(my1307.gettime( &sec, &min, &hours, &day, &date, &month, &year));
+
+    lcd.cls();
+    lcd.locate(0,0);
+    lcd.printf("%d:%d:%d",hours,min,sec);
+    lcd.locate(0,1);
+    lcd.printf("%d/%d/%d",date,month,year);
+ 
+     junk = 0x39;                            // just a junk value do read and write test to DS1307 ram
+     test_rw(my1307.write( 0x20, junk));     // this should write the value of junk to register 0x20 (a ram location) in the ds1307.
+     junk = 0;                               // clear junk to show that when the register is read from the correct value is obtained
+     test_rw(my1307.read( 0x20, &junk));     // this should read register 0x20
+ }
+ }
\ No newline at end of file
diff -r 000000000000 -r a1b3b73a7312 mbed.bld
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Thu Nov 27 10:29:01 2014 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/031413cf7a89
\ No newline at end of file