⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rm_all.lst

📁 用51单片机对Philips的RC5遥控编码进行解码,得到遥控器的键值
💻 LST
📖 第 1 页 / 共 2 页
字号:
 168   3                                                      {       re_lead_width++;}
 169   3                                                                              #if 0
                                                                                              if (re_lead_width <=30 )        /* about        13.4msec=440usec *30 */
                                                                                                              {  /* if lead code width is less then 13.4ms, so the lead is NG*/
                                                                                                                      Fre_lead=0 ;
                                                                                                                      re_lead_width=0;
                                                                                                                      re_loc=0;
                                                                                                                      re_with =0;                     /* conter for pluse width caculate */
                                                                                                                      re_modc=0;
                                                                                                              }
                                                                                                      else                    /* lead code is ok */
                                                                                                              {
C51 COMPILER V7.07   RM_ALL                                                                04/07/2004 10:37:37 PAGE 4   

                                                                                                                      re_loc =        0;             /*       */
                                                                                                                      re_with =       0;
                                                                                                                      re_lead_width=0;
                                                                                                                      Fre_lead=0;
                                                                                                                      re_modc = 1;                    /* go to bit receive mode */
                                                                                                              }
                                                                                      #endif                  
 187   3                                                      /**/
 188   3                                      }
 189   2                              else
 190   2                                      {if(Fre_lead==1)
 191   3                                              {
 192   4                                                              /*if (re_lead_width <= 32)*/
 193   4                                                       {
 194   5                                                              re_lead_width++;
 195   5                                                       
 196   5                                                       if(P20&&(re_lead_width>=22)&&re_lead_width<=30) 
 197   5                                                              {
 198   6                                                                      re_loc = 0;             /**/
 199   6                                                                      re_with = 0;
 200   6                                                                      re_lead_width=0;
 201   6                                                                      /*Fre_lead=0;*/
 202   6                                                                      re_modc = 1;
 203   6                                                              }
 204   5                                                       }
 205   4                                              }
 206   3                                      }       
 207   2                              break;
 208   2                      case 1:                                                         /* */
 209   2                              if (Fremin)                                     /* check the IRQ input                          */
 210   2                              {                                                               /* The 2th fall edge of the frame       */
 211   3                                      Fremin  = 0;                            /* clear the IRQ flag                           */
 212   3                                      re_with = 0;                            /* conter for pluse width cacular       */
 213   3                                      re_loc  = 0;                            /* clear bit location */
 214   3      
 215   3                                      re_modc = 2;            /*next active set */
 216   3                                      remodata.remo = 0;      /*clear the recive memory*/
 217   3                              }
 218   2                              break;
 219   2                      case 2:     
 220   2                              if (Fremin)
 221   2                                      {Fremin = 0;                 /**/
 222   3                                              if (re_with <= 6 )/*3.5msec=440usec*8*/
 223   3                                              {               
 224   4                                                      remodata.remo <<= 1;
 225   4                                                      /* re_blnk = re_with;   */
 226   4                                                      if( re_with >= 3) /* 32.15us * 50 = 1.6ms */
 227   4                                                              {
 228   5                                                                      remodata.remo |=  0x01;
 229   5                                                              }
 230   4                                                      re_loc++;
 231   4                                                      re_blnk = RE_BLANK1_CONUNT;     /*?*/
 232   4                                                      
 233   4                                                      /**/
 234   4                                                      if (re_loc >= REMOCON_CODE_BITE)   /**/
 235   4                                                      {
 236   5                                                              re_loc = 0;         /**/
 237   5                                                      /*      rem_data_tmp=remodata.remo;*/
 238   5                                                              re_modc = 3;            /**/
 239   5                                                      }
 240   4                                              }
 241   3                                              else                    /* re_with>6  not good data ,start again */
C51 COMPILER V7.07   RM_ALL                                                                04/07/2004 10:37:37 PAGE 5   

 242   3                                                      {
 243   4                                                      re_loc = 0;             /**/
 244   4                                                      re_modc = 0;            /**/
 245   4                                                      }
 246   3                                              re_with = 0;                /**/
 247   3                                      }
 248   2                              else                                                    /* IRQ O not occur*/
 249   2                                      {if (re_with <= 6)      /**/
 250   3                                              {re_with++;}
 251   3                                       if (re_with>6)
 252   3                                          {
 253   4                                          re_loc = 0;             /**/
 254   4                                              re_modc = 0;
 255   4                                          }
 256   3      
 257   3                                      }
 258   2                              break;
 259   2              
 260   2                      case 3:  /* Fremin==Flag remocon in */
 261   2                              if (Fremin) 
 262   2                                      {                       
 263   3                                              /*Fremin = 0;                           */
 264   3                                              re_with = 0;                    /**/
 265   3                                              re_modc = 0;                    /**/
 266   3                                              remodata.remo = 0;
 267   3                                      }
 268   2                              else{
 269   3                                              re_modc = 0;
 270   3                                              Frem_ok = 1;    /*1 frame receive       */
 271   3                                              
 272   3                                      }
 273   2                              break;
 274   2                              
 275   2                              
 276   2                      case 4:          /*reverse for abnormal mode ,eg   when mcu run in sleep mode */
 277   2                              if (Fremin) {                           /*              */
 278   3                                      Fremin = 0;                             /**/
 279   3                                      re_with = 0;                    /**/
 280   3                                      re_blnk = RE_BLANK1_CONUNT;                             
 281   3                              }
 282   2                              else {                                          /**/
 283   3                                      if (re_with < 7){               /**/
 284   4                                              re_with++;                       /*pluse width conter flash */
 285   4                                      }
 286   3                                      else{                                                           
 287   4                                              re_loc = 0;             /*Pluse too wide */
 288   4                                              re_modc = 0;            /**/
 289   4                                      }
 290   3                              }
 291   2                              break;  
 292   2              
 293   2                      default:
 294   2                              re_modc = 0;                    /*      */
 295   2                              break;
 296   2              }
 297   1      }
 298          
 299          
 300          /***********************************************************************
 301          #ifdef  DOC
 302          TITLE   :       irq0
 303          TITDOC  :       external irq 0 for RM input
C51 COMPILER V7.07   RM_ALL                                                                04/07/2004 10:37:37 PAGE 6   

 304          INPUT   :       
 305          OUTPUT  :       
 306          DATE    :       
 307          #endif
 308          ***********************************************************************/
 309          void irq0 (void) interrupt 0 using 1
 310          {
 311   1              
 312   1              if (!REMIN_P)
 313   1                      {                               /* IRQ  REMIN_P:p20in=0 */
 314   2                      /*{ if cpu run in slow mode , then exit slow mode }*/
 315   2                      
 316   2                      Fremin = 1;
 317   2                      }
 318   1      }
 319          
 320          
 321          void tm1irq (void) interrupt 2 using 2  /*Timer 1 work @ 400us overflow mode*/
 322          {
 323   1                      getrem();
 324   1      }
 325          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    327    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     12    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =      3    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -