Export for Dan

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
atravieso
Date:
Fri Sep 18 18:09:52 2015 +0000
Parent:
0:3887e1d343e5
Commit message:
I think this works. I was running DS1682_LPC1768 (68) and it appeared to be counting up seconds.

Changed in this revision

ETC.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 3887e1d343e5 -r 933375506717 ETC.cpp
--- a/ETC.cpp	Fri Sep 04 16:49:29 2015 +0000
+++ b/ETC.cpp	Fri Sep 18 18:09:52 2015 +0000
@@ -17,7 +17,8 @@
  
  
 int main() {
-
+    while(1){
+unsigned char ttal, ttalm, ttahm, ttalh, evntl, evnth;
  long int tmp;
 
         i2c.start();
@@ -25,31 +26,32 @@
         i2c.write(5);
         i2c.start();
         i2c.write(0xD6  | 1);
-unsigned char ttal = i2c.read(5);
-unsigned char ttalm = i2c.read(6);
+    ttal = i2c.read(5);
+    ttalm = i2c.read(6);
+    ttahm = i2c.read(7);
+    ttalh = i2c.read(8);
+    i2c.stop();
 
-unsigned char ttahm = i2c.read(7);
+    tmp = ((long int) ttalh << 24) + ((long int) ttahm << 16) + ((long int) ttalm << 8) + (long int) ttal;
+    tmp >>= 2;
+    printf("\r\nEvent Time: %d sec ", tmp);
 
-unsigned char ttalh = i2c.read(8);
+\
 
 i2c.stop();
 
-tmp = ((long int) ttalh << 24) + ((long int) ttahm << 16) + ((long int)
-ttalm << 8) + (long int) ttal;
-tmp >>= 2;
-printf("\r\nEvent Time: %d sec ", tmp);
-i2c.stop();
-
 //
-i2c.start();
-        i2c.write(0xD6);
-        i2c.write(9);
-        i2c.start();
-        i2c.write(0xD6  | 1);
-unsigned char evntl = i2c.read(9);
-unsigned char evnth = i2c.read(0xa);
-printf("\r\nEvent Count: %d", ((int) evnth << 8) + evntl);
-i2c.stop();
-
+//i2c.start();
+//        i2c.write(0xD6);
+//        i2c.write(9);
+//        i2c.start();
+//        i2c.write(0xD6  | 1);
+//evntl = i2c.read(9);
+//evnth = i2c.read(0xa);
+//printf("\r\nEvent Count: %d", ((int) evnth << 8) + evntl);
+//tmp >>= 2;
+//i2c.stop();
+wait(1);
 }
 
+}
\ No newline at end of file