RTC 1338 Nboard

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
gr66
Date:
Mon Feb 27 13:07:21 2017 +0000
Commit message:
RTC 1338 Nboard

Changed in this revision

IHM.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/IHM.lib	Mon Feb 27 13:07:21 2017 +0000
@@ -0,0 +1,1 @@
+https://developer.mbed.org/teams/NBoard/code/IHM/#ccd7c3d1024d
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Feb 27 13:07:21 2017 +0000
@@ -0,0 +1,34 @@
+#include "IHM.h"
+
+IHM ihm;  //clase IHM
+I2C i2c(PB_7,PB_6);
+Serial pc(USBTX, USBRX);  // I/O terminal PC
+int main()
+{
+    ihm.LCD_clear();
+    ihm.LCD_gotoxy(0,1);
+    ihm.LCD_printf("HTC DS 1338 ");
+    wait(2);
+    ihm.LCD_clear();
+    int address = 0xd0;
+    // init RTC
+    char data[8]= {0x00,0x30,0x59,0x23,0x1,0x31,0x12,0x16}; // reg de départ/ss/mm/hh/js/jj/mm/aa
+    data[0]=0x00;
+    i2c.write(address, data, 8,false);
+    
+
+    while(1) {
+        // lecture RTC
+        data[0]=0;
+        wait(1);
+        i2c.write(address, data, 1,false);
+        i2c.read(address, data, 7,false);
+        
+
+        ihm.LCD_gotoxy(0,0);
+        ihm.LCD_printf("%02x:%02x:%02x",data[2],data[1],data[0]);
+        ihm.LCD_gotoxy(1,0);
+        ihm.LCD_printf("%02x/%02x/%02x",data[4],data[5],data[6]);
+
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Feb 27 13:07:21 2017 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/d75b3fe1f5cb
\ No newline at end of file