Ejemplo RTC

Dependencies:   Debounced FPointer RTC-DS1307 TextLCD keypad mbed

Fork of IngresoHORA by Jesse Beltran

Revision:
2:21ba0afb6205
Parent:
1:8f03434fc55b
Child:
3:53a2fd2fe4cb
--- a/main.cpp	Wed Apr 30 23:45:57 2014 +0000
+++ b/main.cpp	Thu May 01 00:29:00 2014 +0000
@@ -2,7 +2,6 @@
 //Jesse Mauricio Beltran
 //Michelle Maceas Henao
 
-
 #include "mbed.h"
 #include "Rtc_Ds1307.h"
 #include "TextLCD.h"
@@ -36,7 +35,7 @@
 {
         
         key=Key;
-        if(Keytable[key]=='A')//Lectura del 
+        if(Keytable[key]=='A')//Lectura del Reloj.
         {
             Write=0;
             Read=1;
@@ -76,7 +75,6 @@
         return 0;
 }
 
-//PPWM
 int PWMmodule(float ppp,float Dd)
 {
         Pwm.period(ppp);
@@ -87,6 +85,11 @@
 }
 int main()
 {
+    lcd.cls();
+    lcd.printf("Configuracion de");
+    lcd.locate(0,2);
+    lcd.printf("   Parametros");
+    //wait(0.2);
     Keypad keypad(PTA2,PTD4,PTD3,PTD1,PTD2,PTD0,PTD5,PTA13);
     keypad.CallAfterInput(&cbAfterInput);
     keypad.Start();  // energiza las columnas C0-C3 Del Keypad
@@ -94,26 +97,18 @@
     Rtc_Ds1307::Time_rtc tm = {};
     while(1)
     {   
-        pc.printf("*************************************\n");
-        pc.printf("* Menu for RTC Test :               *\n");
-        pc.printf("* read  - reads the clock           *\n");
-        pc.printf("* start - start the clock           *\n");
-        pc.printf("* stop  - stop the clock            *\n");
-        pc.printf("* write - write the clock           *\n");
-        pc.printf("* ena   - enable Square wave output *\n");
-        pc.printf("* dis   - disable square wave outp. *\n");
-        pc.printf("*************************************\n");
-    
+        
         if(Read==1)
         {
-            //rtc.getTime(tm);
             lcd.cls();
-            lcd.locate(0,1);            // Print and refresh data on line 2 of the LCD display     
+            lcd.printf("     Lectura!");
+            wait(0.2);
+            rtc.getTime(tm);
+            lcd.cls();
+            lcd.locate(0,1);            
             lcd.printf("%.2D",tm.hour);
             lcd.printf(":%.2D",tm.min);
             lcd.printf(":%.2D",tm.sec);
-            //lcd.printf("%d",tm.hour);
-        
             lcd.locate(0,0);
             lcd.printf("%.2D",tm.mon);
             lcd.printf("/%.2D",tm.date);
@@ -122,12 +117,11 @@
         }
         if(Write==1)
         {
-            //lcd.cls();
-            //lcd.printf("Ingrese Datos");
+            lcd.cls();
+            lcd.printf("   Escritura");
             if(Panta.falling())
             {
                 pp=pp+1;
-                //lcd.printf("");
             }
             if(pp==1)
             {