Este es el Ejercicio 3 del TP Nº1 de Sistemas Embebidos. El objetivo del programa es mejorar el funcionamiento de una cafetera "ATMA CA8180"

Dependencies:   DS1820 antirrebote matriz mbed tsi_sensor

Fork of DS1820_HelloWorld by Erik -

Revision:
6:8cc6048e0376
Parent:
5:b8a9f4da4205
--- a/Coffee_Maker_Upgrade.cpp	Wed May 23 00:03:56 2018 +0000
+++ b/Coffee_Maker_Upgrade.cpp	Tue Jun 12 17:10:21 2018 +0000
@@ -3,7 +3,7 @@
 #include "DS1820.h"
 #include "antirrebote.h"
 #include "tsi_sensor.h"
-#define TIME 10000
+#define TIME 15000
 
 #if defined (TARGET_KL25Z) || defined (TARGET_KL46Z)
   #define ELEC0 9
@@ -116,7 +116,7 @@
 
     timer_func.attach(&interrupt_time_func,1);   //Llamará a la función "interrupt_time_func" cada 1s
     timer.attach(&RealTime_Clock,0.1);          //Llamará a la función "RealTime_Clock" cada 0.1s (100ms)
-    timer_puls.attach(&int_puls,0.001);          //Llamará a la función "int_puls" cada 0.001s (1ms)
+    timer_puls.attach(&int_puls,0.01);          //Llamará a la función "int_puls" cada 0.001s (1ms)
     timer_sens.attach(&int_sens,0.1);            //Llamará a la función "int_sens" cada 0.1s (100ms)
     //Estados iniciales de los LEDs
     LED_ROJO = LED_OFF;
@@ -138,14 +138,12 @@
         P_prog.setPin(PTC4);
         P_on.setPin(PTC7);
         
-        if(t_puls == 0){
-            t_puls = 10;
+
             //Adquisición y guardado de los estados de los pulsadores
             PULSO_prog = P_prog.antiRebote();
             PULSO_hora = P_hora.antiRebote();
             PULSO_minuto = P_minuto.antiRebote();
-            PULSO_on = P_on.antiRebote();
-        }   
+            PULSO_on = P_on.antiRebote();  
         iniciacion(PULSO_prog,PULSO_hora,PULSO_minuto); //Configuración de la hora actual y del modo automático
         if (hab_func == ON)   //Habilita el funcionamiento cuando se termina la configuración
             funcionamiento(PULSO_on);
@@ -174,6 +172,7 @@
             LED_AZUL = LED_OFF;
             R_Cal = OFF;
             Bomba_out = OFF;
+            med=0;
             if(Puls_prog == ON){
                 stateI = s_set_auto;
                 strcpy(M," AUTO ");//Escribe la matriz
@@ -251,6 +250,7 @@
             LED_ROJO = LED_ON;
             R_Cal = OFF;
             Bomba_out = OFF;
+            med=0;
                     if (Puls_on == ON)
                     {
                         stateF = s_auto_on;
@@ -315,12 +315,12 @@
         }else if(hora_uni > '9'){
             hora_uni = '0';
             hora_dec++;
+        }else if(minuto_uni > '9'){
+            minuto_uni = '0';
+            minuto_dec++;
         }else if( minuto_dec > '5'){
             minuto_dec = '0';
             hora_uni++;
-        }else if(minuto_uni > '9'){
-            minuto_uni = '0';
-            minuto_dec++;
         }
     }
 }
@@ -500,9 +500,10 @@
 }
 //Función de interrupción del objeto antirrebote
 void int_puls (void){
-    if(t_puls > 0){
-        t_puls--;
-    }
+    P_minuto.DebTime();
+    P_hora.DebTime();
+    P_prog.DebTime();
+    P_on.DebTime();
 }
 //Función de interrupción del sensado de temperatura. Sensa 1 vez cada 5 segundos
 void int_sens(){