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

📄 g.lst

📁 红外遥控时钟温度计语音报时间和温度deshejifangan
💻 LST
字号:
C51 COMPILER V8.02   G                                                                     05/07/2008 17:48:58 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE G
OBJECT MODULE PLACED IN g.OBJ
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE g.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /*********************************************************************/
   2          /*                                                                                                                                       */
   3          /*              本程序由胡寓洋编写,仅供学习使用                                                         */
   4          /*                                                                                                                               */
   5          /*                                                                                                                                       */
   6          /*                                                                                                                                       */
   7          /*********************************************************************/
   8          
   9          
  10          
  11          
  12          
  13           #include<at89x52.h>
  14          #include<intrins.h>
  15          //#define ovf P3_6
  16          #define cs P3_7         //片选
  17          #define pd P3_6         //功耗选择
  18          #define oem P3_5        //放音时的一端结束标志,低有效
  19          #define pr P3_4         //高时为放音,低时为录音
  20          
  21          #define a8 P1_1          //为十条地址线 
  22          #define a9 P1_0
  23          #define date P0
  24          #define deng P1_6
  25          #define deng1 P1_7
  26          #define uchar unsigned char 
  27          #define uint unsigned int 
  28          void play1(void);
  29          uchar  display[6]={0x08,0x09,0x10,0x05,0x07,0x09};
  30          void play(uchar a);
  31          uchar addr[19]={0x00,0x0a,0x14,0x1e,0x28,
  32                                  0x32,0x3c,0x46,0x50,0x5a,
  33                                          0x64/*10*/,0x6e/*.点..*/,0x8c/*现在温度是*/,
  34                                          0xaa/*摄氏度*/,0xb4/*分*/,0xbe/*秒*/,0xc8/*现在时间是*/,0xdc};//0到9的地址每个地址有1秒钟时间
  35          
  36          
  37          void delay(uchar a);
  38          
  39           uchar num;
  40           uchar numb,numb1;
  41          void play2(void);
  42          /**********************************************
  43                             放音程序
  44          ***********************************************/
  45          void play(uchar a)
  46          {uchar b8=0,b9=0;
  47   1                                                                                                                       
  48   1      cs=1;                                                                                           
  49   1      pd=0;
  50   1      if(addr[a]|0x0a==addr[a++])
  51   1              {
  52   2              date=addr[a];
  53   2              a8=b8;
  54   2              a9=b9;
  55   2              pr=1;_nop_();_nop_();_nop_();
C51 COMPILER V8.02   G                                                                     05/07/2008 17:48:58 PAGE 2   

  56   2              cs=0;
  57   2              while(oem==1);
  58   2              cs=1;
  59   2              pd=1;_nop_();_nop_();_nop_();
  60   2              }
  61   1      }
  62          void play2(void)
  63          {
  64   1              uchar g;                
  65   1      for(g=7;g<19;g++)
  66   1      {
  67   2              play(g);
  68   2              delay(1500);
  69   2      }       
  70   1      
  71   1      }
  72          void play3(void)
  73          {
  74   1              uchar ak;               
  75   1      for(ak=0;ak<19;ak++)
  76   1      {               delay(40000);
  77   2              play(ak);
  78   2              
  79   2      }       
  80   1      
  81   1      }
  82          
  83          
  84          /************************************************************
  85                               录音程序
  86           **********************************************************/
  87          void record(uchar a)
  88          { uchar b8=0,b9=0;
  89   1      
  90   1      cs=1;
  91   1      pd=0;
  92   1      if(addr[a]|0x0a==addr[a++])
  93   1      {
  94   2              date=addr[a];
  95   2              a8=b8;
  96   2              a9=b9;
  97   2              pr=0;_nop_();_nop_();_nop_();
  98   2              cs=0;
  99   2              while(!P2_0);
 100   2      
 101   2              cs=1;
 102   2              pd=1;_nop_();_nop_();_nop_();
 103   2              P2_1=1;
 104   2      }
 105   1      }
 106          
 107          
 108          
 109          
 110          /*****************************************************************************
 111                                      录音主程序
 112          ISD2560内部存储器共分600段地址,每一段对应0.1秒,故总共60秒,随便你分几段来用;
 113          该段程序的用法:当按下某段的录音键时开始录音,当放开该键时录音结束,按一下该段
 114                          的放音键,可听听录音效果,不过该段录音时间要把握,以免覆盖到下
 115                                          段地址去
 116          *******************************************************************************/
 117          
C51 COMPILER V8.02   G                                                                     05/07/2008 17:48:58 PAGE 3   

 118          
 119          /*******************************************
 120                            按键扫描
 121          **********************************************/
 122          void delay(uchar a)
 123          {uchar i,j;
 124   1              for(i=0;i<a;i++)
 125   1                      for(j=0;j<110;j++);
 126   1      }
 127          
 128          
 129          void keyscan()
 130          {
 131   1      
 132   1                      if(P2_0==0)
 133   1                      {
 134   2                              delay(10);
 135   2                              if(P2_0==0)
 136   2                              {       
 137   3                      
 138   3                              TMOD=0x01;
 139   3                              TH0=0x15;
 140   3                              TL0=0Xa0;
 141   3                              EA=1;
 142   3                              ET0=1;
 143   3                              TR0=1;
 144   3                              deng=0;
 145   3                          delay(500);
 146   3                              delay(50);
 147   3                      if(P2_0==1)
 148   3                      {
 149   4                              delay(10);
 150   4                              if(P2_0==1)
 151   4                              {
 152   5                                      num++;
 153   5                              }
 154   4                      }
 155   3                      
 156   3                      if(num==19)
 157   3              {       deng1=0;
 158   4                      num=0;
 159   4              
 160   4              } 
 161   3                              while(!P2_0);
 162   3                              deng=1; 
 163   3                              }
 164   2                        }
 165   1      
 166   1                       
 167   1              if(P2_1==0)
 168   1                      {
 169   2                         delay(10);
 170   2                              if(P2_1==0)
 171   2                              {       
 172   3                                      play(numb);
 173   3                                      while(!P2_1);
 174   3                                      numb++; 
 175   3                              }
 176   2                              if(numb==15)
 177   2                              {
 178   3                                      numb=0;
 179   3                              } 
C51 COMPILER V8.02   G                                                                     05/07/2008 17:48:58 PAGE 4   

 180   2      
 181   2                      }
 182   1              if(P2_2==0)
 183   1                      {
 184   2                              delay(10);
 185   2                              if(P2_2==0)                                                                                                                                                      
 186   2                              {
 187   3                                play2();
 188   3                              }
 189   2                      }
 190   1              if(P2_3==0)
 191   1                      {
 192   2                              delay(10);
 193   2                              if(P2_3==0)
 194   2                              {
 195   3                                delay(10000);
 196   3                                play3();
 197   3                              }
 198   2                      }
 199   1                      if(P2_6==0)
 200   1                      {
 201   2                              delay(10);
 202   2                              if(P2_6==0)
 203   2                              { 
 204   3                              
 205   3                                delay(510);
 206   3                                play(12);
 207   3                                delay(510);
 208   3                                play(display[0]);
 209   3                                delay(510);
 210   3                                play(10);
 211   3                                delay(510);
 212   3                                play(display[1]);
 213   3                               delay(510);
 214   3                                play(11);
 215   3                                delay(510);
 216   3                              
 217   3                                play(display[5]);
 218   3                                delay(110);
 219   3                                       play(16);
 220   3                               
 221   3                              }
 222   2                      }
 223   1      }
 224          
 225          
 226          void t0(void) interrupt 1 using 0
 227           {
 228   1                
 229   1                 EA=0;
 230   1                ET0=0;
 231   1                TR0=0;
 232   1                deng1=1;
 233   1                      record(num);
 234   1                      
 235   1       }
 236          /*void te(void) interrupt 2 using 1
 237           {
 238                    EA=0;
 239                    ET1=0;
 240                    TR1=0;
 241                    deng=1;
C51 COMPILER V8.02   G                                                                     05/07/2008 17:48:58 PAGE 5   

 242                    numb1++;
 243                          if(numb1==15)
 244                  {       
 245                          numb1=0;
 246                  
 247                  } 
 248           
 249          
 250          } */                                             //0346
 251          
 252          void main()
 253          {P2=0xff;
 254   1       P1=0xff;
 255   1       P0=0xff;
 256   1       P3=0xff;
 257   1       num=16;
 258   1       numb=0 ;
 259   1       // numb1=9 ;
 260   1      while(1)
 261   1      {       
 262   2              keyscan();
 263   2       }
 264   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    429    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     28       2
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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