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

📄 text2.lst

📁 自己在keil51中用C实现了一个电子钢琴展览项目
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.02   TEXT2                                                                 03/26/2008 13:44:51 PAGE 1   


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

line level    source

   1          #include <absacc.h>
   2          #include <reg51f.h>
   3          #include <intrins.h>
   4          #define uchar unsigned char
   5          #define uint  unsigned int
   6          
   7          
   8          
   9          unsigned char  receive_len,send_num,k,i,qunum ;
  10          unsigned char  receive_check;
  11          unsigned char  send_check;
  12          unsigned char  receive_buf[8]   ; //定义接收缓冲区
  13          unsigned char  send_buf[8];  //定义发送缓冲区
  14          unsigned char  qu[3]   ;
  15          sbit     CO= P1^3;   //关机键            
  16          sbit     CO1=P1^2;
  17          sbit     shutdown_s= P2^6;       //关大屏幕
  18          sbit     shutdown_c= P2^2;       //     关计算机
  19          sbit     shutdown_f= P2^7;        // 关烟雾器
  20          sbit     shutdown= P2^0;         //关总电源
  21          sbit     smog_hand=P1^1;        //烟雾手动
  22          sbit     smog_open=P2^1;        //放烟雾
  23          sbit     start=P1^0;//开机(遥控器)
  24          sbit     play_1=P3^3;//连续播放即循环播放  
  25          sbit     play_2=P3^2;//单次播放即手动检测激光信号
  26          sbit     enable=P2^5;//激光琴总允许信号
  27          sbit     IC4=P1^4;
  28          sbit     ID4=P1^5;
  29          sbit     IE4=P1^6;
  30          sbit     IF4=P1^7;
  31          sbit     SDA=P2^3;
  32          
  33          bit    receive_status;
  34          bit    send_status;
  35          bit    auto_smog;
  36          bit    sr_flag;
  37          bit    CO_flag;
  38          bit    start_flag;
  39          bit    start_flag1;
  40          bit    auto_flag;   
  41          bit    sh_flag;
  42          bit    play1_flag;
  43          bit    play2_flag;
  44          bit    pause;
  45          bit    con;
  46          bit    start_flag;
  47          bit    KJOK;
  48          bit     GJOK;
  49          bit      pp;
  50          bit    qmend;
  51          bit     recev_first;
  52          
  53          uint      time_50ms;
  54          uint      time_1s;
  55          uint      time_s;
C51 COMPILER V8.02   TEXT2                                                                 03/26/2008 13:44:51 PAGE 2   

  56          uint      time_s_gj;
  57          uint      time_s_kj; 
  58          uint      time_s_3;
  59          uint      total;
  60          
  61          
  62          void  delay(void)
  63          { int t;
  64   1      for(t=0;t<=800;t++)     {}
  65   1      }
  66          /*void  diao(void) interrupt  9  
  67          {         if(GJOK==0)
  68                    while(1) ;
  69          } */
  70          void Timer(void) interrupt  1               
  71          {
  72   1      TR0=0;
  73   1      TH0=0x4c;            
  74   1      TL0=0x00;
  75   1      TR0=1; 
  76   1              
  77   1      time_50ms++;
  78   1      if(time_50ms==20)
  79   1      {time_1s++;
  80   2      time_s++;
  81   2      time_s_3++;
  82   2      time_s_kj++;
  83   2      time_s_gj++;
  84   2      time_50ms=0;
  85   2      }
  86   1      
  87   1      } 
  88          void rs232(void) interrupt 4              
  89          {
  90   1              if(RI==1)
  91   1      {        
  92   2                      if(receive_status==0)
  93   2      
  94   2              {  if (recev_first==0)
  95   3                        {      
  96   4                              receive_buf[0] = SBUF;//receive_buf[receive_len] = SBUF;
  97   4                              receive_len = 1;//receive_len = receive_len+1;
  98   4                              recev_first=1;
  99   4                        }
 100   3                      else
 101   3                        {
 102   4                              receive_buf[receive_len] = SBUF;
 103   4                              receive_len=receive_len+1;
 104   4                              if(receive_len==8)
 105   4                              {
 106   5                              receive_status=1;
 107   5                              //receive_len=0;
 108   5                              recev_first=0;
 109   5                        //  shutdown_c=~shutdown_c;   
 110   5                              }
 111   4                        }
 112   3              }
 113   2              RI=0;
 114   2      }
 115   1              else
 116   1              {
 117   2                      if(send_status==0)
C51 COMPILER V8.02   TEXT2                                                                 03/26/2008 13:44:51 PAGE 3   

 118   2                      {   SBUF =send_buf[send_num];
 119   3                              send_num = send_num+1;
 120   3                              if(send_num==8)
 121   3                              {send_status = 1;
 122   4                              send_num=1;} 
 123   3                      }
 124   2                  
 125   2              TI=0;   
 126   2              } 
 127   1              
 128   1      } 
 129          
 130          
 131          void pca(void) interrupt 6
 132          { 
 133   1      
 134   1      
 135   1      if(IC4==0&&ID4==0&&IE4==0&&IF4==0)
 136   1              { 
 137   2              for(k=0;k<=20;k++)
 138   2            {delay(); 
 139   3                }
 140   2          if(IC4==0&&ID4==0&&IE4==0&&IF4==0)
 141   2                      {
 142   3                      //      shutdown_c=~shutdown_c;
 143   3                              if(CCF1==1)
 144   3                              {
 145   4                              total=total+1;
 146   4                              i=i+1;
 147   4                               CCF1=0;
 148   4                              }
 149   3                              if(CCF2==1)
 150   3                              { 
 151   4                              total=total+2;
 152   4                              i=i+1;
 153   4                               CCF2=0;
 154   4                              }
 155   3                              if(CCF3==1)
 156   3                              { 
 157   4                              total=total+3;
 158   4                              i=i+1;
 159   4                              CCF3=0;
 160   4                              }
 161   3                              if(CCF4==1)
 162   3                              { 
 163   4                              total=total+4;
 164   4                              i=i+1;
 165   4                              CCF4=0;
 166   4                              }
 167   3                      }
 168   2              }
 169   1      if((i>=3)&&((total-3)>=0)&&((total-3)<10))
 170   1      {
 171   2               qunum=total-3;
 172   2               pp=0;
 173   2                CCAPM1=0x00;
 174   2                CCAPM2=0x00;
 175   2                CCAPM3=0x00;
 176   2                CCAPM4=0x00;
 177   2                        EC=0;
 178   2      }
 179   1      
C51 COMPILER V8.02   TEXT2                                                                 03/26/2008 13:44:51 PAGE 4   

 180   1      else if(i>3)
 181   1      {
 182   2              i=0;
 183   2              total=0;
 184   2      }
 185   1      
 186   1      }  
 187          
 188          main()
 189          {  
 190   1      AUXR= 0x0; 
 191   1      shutdown_s=0;
 192   1      shutdown_c=0;
 193   1      shutdown_f=0; 
 194   1      shutdown=1;     
 195   1      smog_open=0;
 196   1      enable=1;
 197   1      CO1=1;
 198   1      
 199   1      SDA=1;
 200   1      IC4=1;
 201   1      ID4=1;
 202   1      IE4=1;
 203   1      IF4=1;
 204   1      TMOD = 0x01;  //定时器1,2工作于方式1
 205   1      TH0=0x4c;             
 206   1      TL0=0x00;
 207   1      TR0=1;
 208   1      RCAP2H=0xff;     //        定时器二做波特率发生器  9600
 209   1      RCAP2L=0xdC;    
 210   1      T2CON=0x34;     //
 211   1      PCON = 0x00;//SMOD=0;
 212   1      SCON = 0x50;//串行口于模式1,8位UART
 213   1      IE = 0x92;//turn on EA,ES,ET0,EC
 214   1      //EBO=1;
 215   1      IP=0x10;
 216   1      CMOD=0x00;//PCA允许中断                                                     
 217   1      CCAPM0=0x00;
 218   1      CCAPM1=0x00;
 219   1      CCAPM2=0x00;
 220   1      CCAPM3=0x00;
 221   1      CCAPM4=0x00;
 222   1      CCF1=0;
 223   1      CCF2=0;
 224   1      CCF3=0;
 225   1      CCF4=0;
 226   1         
 227   1      receive_status =0;//一串数据接收成功标志 1-成功
 228   1      send_status =0;
 229   1      send_num=1;
 230   1      play_1=1;
 231   1      play_2=1;
 232   1      smog_hand=1;
 233   1      CO=1;
 234   1      start=1;
 235   1      sr_flag=0;
 236   1      play1_flag=0;
 237   1      play2_flag=0;
 238   1      KJOK=1;
 239   1      CO_flag=1;
 240   1      start_flag=1;
 241   1      auto_flag=1;
C51 COMPILER V8.02   TEXT2                                                                 03/26/2008 13:44:51 PAGE 5   

 242   1      start_flag=1;
 243   1      start_flag1=0;
 244   1      sh_flag=0;
 245   1      pause=0;
 246   1      con=0;
 247   1      receive_len=0;
 248   1      GJOK=1;
 249   1      pp=1;
 250   1      qmend=0;
 251   1      i=0;
 252   1      qu[0]=0;
 253   1      qu[1]=0;
 254   1      qu[2]=0;
 255   1      total=0;
 256   1      recev_first=0;
 257   1      
 258   1      while(1)
 259   1      {  
 260   2       SDA=1;
 261   2       SDA=0;
 262   2       
 263   2      //关机
 264   2      if((CO==0&&sr_flag==0&&play_1==1&&play_2==1&&KJOK==0)||CO1==0)
 265   2      {  delay();
 266   3         delay();
 267   3         delay();
 268   3      if((CO==0&&sr_flag==0&&play_1==1&&play_2==1)||CO1==0)
 269   3       { sr_flag=1;
 270   4         send_buf[0] =0x71;
 271   4         send_buf[1] ='C';
 272   4         send_buf[2] ='O';
 273   4         send_buf[3] =',';
 274   4         send_buf[4] =0;
 275   4         send_buf[5] =0x23;
 276   4         send_check=0xa5^((send_buf[0]+send_buf[1]+send_buf[2]+send_buf[3]+send_buf[4]+send_buf[5])%0x100);    

⌨️ 快捷键说明

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