CAPTURAS DE CÓDIGOS IRDA SIN OSCILOSCOPIO, MIDE LA CANTIDAD DE ESPACIOS EN MODO NORMAL LA DURACIÓN Y EL PROMEDIO DE ELLOS. CON LA AYUDA DE PULSAR BAJO UN BOTÓN DEVUELVE EL CODIGO COMPLETO

Dependencies:   Pulse1 mbed

CÓDIGO PARA LA FRDMKL25Z PARA USAR ESTE PROGRAMA SE DEBE USAR UNA TERMINAL SERIE RECOMIENDO TERMITE SE BAJA DE ESTA PAGINA https://www.compuphase.com/software_termite.htm

RECUERDE QUE UNA VEZ CONECTADA LA FREEDOM BOARD DEBE CONSULTAR EL PUERTO ASIGNADO POR WINDOWS AUNQUE TERMITE DETECTA ESO AUTOMATICAMENTE.

PONER UN SENSOR IRDA DE 3,3V EN EL PUERTO PTD5 Y UN SUICHE EN PTD0 CON EL PUERTO DE SUICHE SIN ACCIONAR DISPARE CON EL CONTROL REMOTO ESPERE A QUE HAGA LA CAPTURA Y ENTREGUE EL PROMEDIO Y NUMERO DE DATOS

LUEGO ACCIONE EL SUICHE DE PTD0 O PONGA EL PUENTE INDICADO EN EL CÓDIGO A TIERRA Y VUELVA A DISPARAR ESPERE UNOS SEGUNDOS Y EL PROGRAMA LE ENTREGARA UN PATRÓN BINARIO DEL CÓDIGO RECIBIDO

NO REQUIERE NI SE DEBE HACER RESET ENTRE EL ACCIONAMIENTO DEL SUICHE TODOS LOS CÓDIGOS QUE SIGA DISPARANDO SERÁN RECONOCIDOS EN MODO NORMAL NO ESTA PROBADO EN CONTROLES SONY PERO PUEDE FUNCIONAR

Files at this revision

API Documentation at this revision

Comitter:
tony63
Date:
Sat Mar 18 07:53:22 2017 +0000
Parent:
0:86c0c1652dd4
Commit message:
se agrego una rutina que transforma el binario en un c?digo decimal pero la cifra desborda esa es la causa de el valor negativo

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r 86c0c1652dd4 -r 69f833c768c8 main.cpp
--- a/main.cpp	Sat Mar 18 00:59:20 2017 +0000
+++ b/main.cpp	Sat Mar 18 07:53:22 2017 +0000
@@ -6,14 +6,16 @@
 DigitalOut led(LED1);
 DigitalOut led2(LED2);
 DigitalIn  mode(PTD0);
-int numN[70];//cadena para almacenar todos los tiempos que conforman los bits de datos
-int numP[70];//cadena para almacenar todos los tiempos que conforman los bits de datos
+int numN[35];//cadena para almacenar todos los tiempos que conforman los bits de datos
+int numP[35];//cadena para almacenar todos los tiempos que conforman los bits de datos
+int bin[35];//cadena para almacenar todos los tiempos que conforman los bits de datos
 int dato; // tiempo de cada dato que se lee
 int pul_low;
 int i,j,k,header,proL,proH; 
-int r;       
+int r; 
+int code;      
 int main(){
-Timer t;
+
 fflush( stdin );
 lop1: header = irda.read_low_us(); 
        if(header>8000) goto seguir;
@@ -49,18 +51,24 @@
              if(!mode){
                for(i=0;i<k-1;++i){
                if(numP[i]>(2*proL)){
-                   pc.printf("1");
+                   bin[i]=1;
+                   for(j=0;j<i+1;++j){bin[i]=bin[i]*2;}
+                   //pc.printf("%d-",bin[i]);
                                    }   
                if(numP[i]<(2*proL)){
-                   pc.printf("0");                    
+                   bin[i]=0;
+                   //pc.printf("%d-",bin[i]);                    
                                    }
                }
                }                
-                              
+           for(i=0;i<k-1;++i){code=code+bin[i];}
+           pc.printf("\n");
+           pc.printf("code=%d",code);
+           code=0;                  
            goto lop1;
            
            }
        }   
  }     
  
-       
\ No newline at end of file
+ //for(j=0;j<i;++j)      
\ No newline at end of file