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

📄 irint.lst

📁 车载显示器
💻 LST
字号:
C51 COMPILER V7.06   IRINT                                                                 01/12/2005 17:37:54 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE IRINT
OBJECT MODULE PLACED IN IrInt.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE IrInt.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          //#ifdef INTERRUPT1
   2          #include "reg51.h"
   3          #include <intrins.h>
   4          #include "Remote.h"
   5          
   6          bit ir_enable;
   7          uCHAR ir_data;
*** ERROR C129 IN LINE 7 OF IRINT.C: missing ';' before 'ir_data'
   8          
   9          bit Filter13(bit le)
  10          {
  11                  bit r;
  12                  r=INT1;
  13                  if(le==1)
  14                  {
  15                          _nop_();
  16                          _nop_();
  17                          _nop_();
  18                          r&=INT1;
  19                          _nop_();
  20                          _nop_();
  21                          _nop_();
  22                          r&=INT1;
  23                  }
  24                  else
  25                  {
  26                          _nop_();
  27                          _nop_();
  28                          _nop_();
  29                          r|=INT1;
  30                          _nop_();
  31                          _nop_();
  32                          _nop_();
  33                          r|=INT1;
  34                  }
  35                  if(r==le)
  36                          return 1;
  37                  else
  38                          return 0;
  39          }
  40          /*遥控接收在此中断程序内完成
  41            数据放在ir_data内*/
  42          /************************************/
  43          /*  Interrupt for IR subroutine     */
  44          /*  external interrupt source INT0  */
  45          /************************************/
  46          void int1Remote(void) interrupt 2
  47          {
  48          /*    static uWORD IR_HEAD=20000;//     =       (XCLK_MCU*3/4);//10738//9000//7500
  49                  static uWORD OFF_CODE=10000;//  =   (IR_HEAD/2);//5369//4500//3750
  50                  uWORD OFF_REP;//        =       (IR_HEAD/4);//2684//2250//      1875
  51                  uWORD REP_CODE;//       =       (IR_HEAD/16);//667//467
  52                  uWORD DELTA ;//    =    300;//250
  53                  uWORD CODE_0_TIME;//=   (IR_HEAD/16);//667//557//467
  54                  uWORD CODE_1_TIME;//=   (CODE_0_TIME*3);//2000//1670//1400*/
C51 COMPILER V7.06   IRINT                                                                 01/12/2005 17:37:54 PAGE 2   

  55                  register BYTE i;
  56                  unsigned int count,count1;              /*计时变量*/
  57                  unsigned int  temp0,temp1,ir_code=0;
  58                  ir_enable=TRUE;
  59                  TMOD=0x11;             /*timer 0 operate in 16 bit mode*/
  60                  EX1=0;
  61                  TL0=0;
  62                  TH0=0;
  63                  TR0=1;
  64                  /************************************/
  65                  /*   Detect IR Head                 */
  66                  /************************************/
  67                  do                /*Detect IR head 9mS*/
  68                  {
  69                          count=(TL0+TH0*256);   /*count :us unit */
  70                          if(Filter13(1)==1) break;
  71                  }while(count<=(IR_HEAD+DELTA));
  72                  TR0=0;                  /*停止计时*/
  73                          count=(TL0+TH0*256);   /*count :us unit */
  74                  
  75                  if(Filter13(0)==1||((count<(IR_HEAD-DELTA*25))))//&&(IR_HEAD!=0xffff)))//||count<(7000))//IR_HEAD!=0xffff
             -)       /*for some noise disturb IR*/
  76                          {
  77                          ir_enable=FALSE; /* no IR head or not suitable for Ir head*/
  78                          EX1=1;
  79                          TR0=1;
  80                          return;
  81                          }
  82                  /************************************/
  83                  /*   Detect OFF CODE     4.5mS      */
  84                  /************************************/
  85                  while(Filter13(0)==1);
  86                  TR0=0;
  87                  TL0=0;
  88                  TH0=0;
  89                  TR0=1;
  90                  do                /*Detect IR OFF CODE*/
  91                  {
  92                          count=(TL0+TH0*256);   /*count :us unit */
  93                          if(Filter13(0)==1) break;
  94                  }while(count<(OFF_CODE+DELTA));
  95                  count1=count;
  96           /*  if(IR_HEAD==0xffff)IR_HEAD =       count*2;//10738//9000//7500
  97                  OFF_CODE  =   IR_HEAD/2;//5369//4500//3750
  98                  OFF_REP =       (IR_HEAD/4);//2684//2250//      1875
  99                  REP_CODE        =       (IR_HEAD/16);//667//467
 100                  DELTA     =     300;//250
 101                  CODE_0_TIME=    (IR_HEAD/16);//667//557//467
 102                  CODE_1_TIME=    (CODE_0_TIME*3);//2000//1670//1400*/
 103                  TR0=0;
 104                  count=(TL0+TH0*256);   /*count :us unit */
 105                  if(count<=(OFF_CODE-DELTA*2))
 106                  {
 107                          /*重复码OFF=2.25*/
 108                          if((count>(OFF_REP-DELTA)&&count<(OFF_REP+DELTA)))
 109                          {
 110                                  TR0=0;
 111                                  TL0=0;
 112                                  TH0=0;
 113                                  TR0=1;
 114                                  do
 115                                  {
C51 COMPILER V7.06   IRINT                                                                 01/12/2005 17:37:54 PAGE 3   

 116                                          count=(TL0+TH0*256);   /*count :us unit */
 117                                          if(Filter13(1)==1) break;
 118                                  }while(count<=(REP_CODE+DELTA));
 119                                  TR0=0;
 120                                  count=(TL0+TH0*256);   /*count :us unit */
 121                                  if(INT1==1)
 122                                  {
 123                                          TR0=0;
 124                                          if(ir_data==REMOTE_KEY_VO_DEC||ir_data==REMOTE_KEY_VO_INC||
 125                                          ir_data==REMOTE_KEY_DECR_F||ir_data==REMOTE_KEY_INCR_F||
 126                                          ir_data==REMOTE_KEY_DECR||ir_data==REMOTE_KEY_INCR)
 127                                          {
 128                                          ir_enable=TRUE; /*注意:ir_data不变*/
 129                                          EX1=0;
 130                                          }
 131                                          else
 132                                          {
 133                                          ir_data=0;
 134                                          ir_enable=FALSE;
 135                                          EX1=1;
 136                                          TR0=1;
 137                                          }
 138                                          return;
 139                                  }
 140                          }
 141                          else
 142                          {
 143                                  ir_enable=FALSE;   /*not suitable for off code*/
 144                                  EX1=1;
 145                                  TR0=1;
 146                                  return;
 147                          }
 148                  }
 149                  /************************************/
 150                  /*   Detect 16 bit address code     */
 151                  /************************************/
 152                  if(ir_enable==TRUE)
 153                  {
 154                          TMOD=0x11;           /*counter start with INT0 and TR0*/
 155                          ir_code=0;              /*初始化变量*/
 156                          for(i=0;i<16;i++)
 157                          {
 158                                  while(INT1==0);
 159                                  TL0=0;
 160                                  TH0=0;
 161                                  TR0=1;
 162                                  do
 163                                  {
 164                                          count=(TL0+TH0*256);   /*count :us unit */
 165                                          if(Filter13(0)==1) break;
 166                                  }while(count<=(CODE_1_TIME+DELTA));     /*INT0为高电平时计时*/
 167                                  TR0=0;
 168                                  ir_code<<=1;
 169                                  if((count>(CODE_1_TIME-DELTA))&&(count<=(CODE_1_TIME+DELTA)))  /*detect 1 code  2.24mS-0.56mS=1.68mS*/
 170                                          ir_code++;
 171                                  else if((count>(CODE_0_TIME-DELTA))&&(count<=(CODE_0_TIME+DELTA)));  /*detect 0 code 1.12mS-0.56mS=0.56
             -mS*/
 172                                  else
 173                                  {
 174                                          ir_enable=FALSE;
 175                                          TR0=1;
 176                                          break;           /*not suitable for address code */
C51 COMPILER V7.06   IRINT                                                                 01/12/2005 17:37:54 PAGE 4   

 177                                  }
 178                          }                /*end for*/
 179                  }
 180                  /************************************/
 181                  /*   Detect 16 bit data code        */
 182                  /************************************/
 183                  if(ir_enable==TRUE&&ir_code==IR_SYSTEM_CODE)/**/
 184                  {
 185                          TMOD=0x11;           /*counter start with INT0 and TR0*/
 186                          ir_code=0;
 187                          for(i=0;i<16;i++)
 188                          {
 189                                  while(INT1==0);
 190                                  TL0=0;
 191                                  TH0=0;
 192                                  TR0=1;
 193                                  do
 194                                  {
 195                                          count=(TL0+TH0*256);
 196                                          if(Filter13(0)==1) break;
 197                                  }while(count<=(CODE_1_TIME+DELTA));     /*INT0为高电平时计时*/
 198                                  TR0=0;
 199                                  //count=(TL0+TH0*256);   /*count :us unit */
 200                                  ir_code<<=1;
 201                                  if((count>(CODE_1_TIME-DELTA))&&(count<=(CODE_1_TIME+DELTA)))  /*detect 1 code 1.68mS*/
 202                                          ir_code++;
 203                                  else if((count>(CODE_0_TIME-DELTA)&&count<=(CODE_0_TIME+DELTA)));  /*detect 0 code 0.56mS*/
 204                                  else
 205                                  {
 206                                          ir_enable=FALSE;
 207                                          TR0=1;
 208                                          break;           /*not suitable for address code */
 209                                  }
 210                          }                /*end for*/
 211                          if(ir_enable==TRUE)
 212                          {
 213                                  temp0=ir_code&0xff00;
 214                                  temp0=~temp0;
 215                                  temp0>>=8;
 216                                  temp1=ir_code&0x00ff;
 217                                  if(temp0!=temp1)
 218                                          ir_enable=FALSE;
 219                                  else
 220                                  {
 221                                          ir_data=(BYTE)(temp1);     /*true code effective*/
 222                                          #ifdef REMOTE_CODE
                                              ir_data=0xff-ir_data;
                                              ir_data=((ir_data<<4)&0xf0)|((ir_data>>4)&0x0f);
                                              ir_data=((ir_data<<2)&0xcc)|((ir_data>>2)&0x33);
                                              ir_data=((ir_data<<1)&0xaa)|((ir_data>>1)&0x55);
                                              #endif
 228                                          ir_enable=TRUE;            /*set ir flag*/
 229                                          EX1=0;
 230          //                              IR_HEAD =       count1*2;
 231                                          return;
 232                                  }
 233                          }
 234                  }
 235                  else
 236                  {       ir_enable=FALSE;
 237                  EX1=1;}
 238          }
C51 COMPILER V7.06   IRINT                                                                 01/12/2005 17:37:54 PAGE 5   

 239          
 240          //#endif
 241          

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

⌨️ 快捷键说明

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