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

📄 main.lst

📁 摇棒设计
💻 LST
字号:
C51 COMPILER V7.50   MAIN                                                                  05/28/2008 00:33:49 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE MAIN
OBJECT MODULE PLACED IN main.OBJ
COMPILER INVOKED BY: C:\Program Files\keil\C51\BIN\C51.EXE main.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include<AT89x52.h>
   2          #include"sci.h"
   3          const unsigned char Disp[]={0x40,0xf3,0x88,0xa0,0x32,0x24,0x04,0xf0,0x00,0x20,0x10,0x06,0x4c,0x80,0x0c,0x1
             -c,0x12};
   4          
   5          #define LongToBin(n) \
   6          (\
   7          ((n >> 21) & 0x80) | \
   8          ((n >> 18) & 0x40) | \
   9          ((n >> 15) & 0x20) | \
  10          ((n >> 12) & 0x10) | \
  11          ((n >> 9) & 0x08) | \
  12          ((n >> 6) & 0x04) | \
  13          ((n >> 3) & 0x02) | \
  14          ((n ) & 0x01) \
  15          )
  16          #define Bin(n) LongToBin(0x##n##l)
  17          
  18          unsigned int flag=0;
  19          unsigned int tmp;
  20          unsigned int time=65536;
  21          unsigned int count;
  22          unsigned int word;
  23          
  24          //int0 interrupt service program
  25          void S_INT0() interrupt 0
  26          {
  27   1      time=count;
  28   1      if(time<30)
  29   1      P1=0xff;
  30   1      else
  31   1      P1=Disp[500/time];
  32   1      outint(time);
  33   1      count=0;
  34   1      word++;
  35   1      }
  36          //T2 interrupt service program
  37          void S_T2() interrupt 5
  38          {
  39   1      count++;
  40   1      TF2  = 0;
  41   1      }
  42          main()
  43          {
  44   1      Sci_init(48);
  45   1      PX0=1;//INT0 high interrupt priority
  46   1      EX0=1;//external interrupt allowed
  47   1      IT0=1;//INT0 choose decrease edge leap
  48   1      
  49   1      //T2 TIME COUNTER initialize
  50   1      RCAP2L  = 0xcb;
  51   1      RCAP2H  = 0xfa;
  52   1      TL2     = 0xcb;
  53   1      TH2     = 0xfa;
  54   1      
C51 COMPILER V7.50   MAIN                                                                  05/28/2008 00:33:49 PAGE 2   

  55   1      CP_RL2= 0;      /* 0=Reload, 1=Capture select */
  56   1      C_T2 = 0;       /* 0=Timer, 1=Counter */
  57   1      TR2  = 1;       /* 0=Stop timer, 1=Start timer */
  58   1      EXEN2= 0;       /* Timer 2 external enable */
  59   1      TCLK = 0;       /* 0=Serial clock uses Timer 1 overflow, 1=Timer 2 */
  60   1      RCLK = 0;       /* 0=Serial clock uses Timer 1 overflow, 1=Timer 2 */
  61   1      EXF2 = 0;       /* Timer 2 external flag */
  62   1      TF2  = 0;       /* Timer 2 overflow flag */
  63   1      ET2  = 1;
  64   1      PT2  = 1;
  65   1      EA=1;
  66   1      P1=0xff;
  67   1      P1=0xff;
  68   1      P1=0xff;
  69   1      P1=0xff;
  70   1      P1=0xff;
  71   1      for(;;)
  72   1      {
  73   2      //outstring("电流超出设定的阀值");
  74   2      //outstring("我是翁华");
  75   2      //显示"W"
  76   2      if(word%140<=20)
  77   2      {
  78   3      tmp=count;
  79   3      //晶振有关
  80   3        if((tmp<=time*1/14||tmp>=time*13/14))
  81   3      {P0=~Bin(11111111);  P2=~Bin(11111111);}
  82   3      else if(tmp<=time*2/14||tmp>=time*12/14 )
  83   3      {P0=~Bin(00000000);  P2=~Bin(00011111);}
  84   3      else if(tmp<=time*3/14||tmp>=time*11/14 )
  85   3      {P0=~Bin(00000000);  P2=~Bin(01100111);}
  86   3      else if(tmp<=time*4/14||tmp>=time*10/14 )
  87   3      {P0=~Bin(10000000);  P2=~Bin(10000111);}
  88   3      else if(tmp<=time*5/14||tmp>=time*9/14 )
  89   3      {P0=~Bin(01100000);  P2=~Bin(00000111);}
  90   3      else if(tmp<=time*6/14||tmp>=time*8/14 )
  91   3      {P0=~Bin(00011000);  P2=~Bin(00000111);}
  92   3      else if(tmp<=time*8/14)
  93   3      {P0=~Bin(00000110);  P2=~Bin(00000111);}
  94   3      }//end if(W)
  95   2      
  96   2      //显示'H'
  97   2      else if(word%140<=40)
  98   2      {
  99   3      tmp=count;
 100   3        if((tmp<=time*3/22||tmp>=time*19/22))
 101   3      {P0=~Bin(11111111);  P2=~Bin(11111111);}
 102   3      else 
 103   3      {P0=~Bin(11100000);  P2=~Bin(00000111);}
 104   3      }//end if(H)
 105   2      
 106   2      //显示 '0'
 107   2      else if(word%140<=60)
 108   2      {
 109   3      tmp=count;
 110   3        if((tmp<=time*3/22||tmp>=time*19/22))
 111   3      {P0=~Bin(11111111);  P2=~Bin(11111111);}
 112   3      else 
 113   3      {P0=~Bin(00000011);  P2=~Bin(00011111);}
 114   3      }//end if(word<=10)
 115   2      
 116   2      //显示'1'
C51 COMPILER V7.50   MAIN                                                                  05/28/2008 00:33:49 PAGE 3   

 117   2      else if(word%140<=80)
 118   2      { 
 119   3      tmp=count;
 120   3        if((tmp>=time*9/22&&tmp<=time*13/22) )
 121   3      {P0=~Bin(11111111);  P2=~Bin(11111111);}
 122   3      else 
 123   3      {P0=~Bin(00000000);  P2=~Bin(00000111);}
 124   3      }//end if(1)
 125   2      
 126   2      //显示'I'
 127   2      else if(word%140<=100)
 128   2      { 
 129   3      tmp=count;
 130   3        if((tmp>=time*9/22&&tmp<=time*13/22) )
 131   3      {P0=~Bin(11111111);  P2=~Bin(11111111);}
 132   3      else if(tmp>=time*7/22&&tmp<=time*15/22)
 133   3      {P0=~Bin(00000011);  P2=~Bin(00011111);}
 134   3      else 
 135   3      {P0=~Bin(00000000);  P2=~Bin(00000111);}
 136   3      }
 137   2      
 138   2      //显示心
 139   2      else if(word%140<=120)
 140   2      { 
 141   3      tmp=count;
 142   3        if((tmp<=time*1/18||tmp>=time*17/18))
 143   3      {P0=~Bin(00011000);  P2=~Bin(00000111);}
 144   3      else if(tmp<=time*2/18||tmp>=time*16/18 )
 145   3      {P0=~Bin(00011100);  P2=~Bin(00000111);}
 146   3      else if(tmp<=time*3/18||tmp>=time*15/18 )
 147   3      {P0=~Bin(00110110);  P2=~Bin(00000111);}
 148   3      else if(tmp<=time*4/18||tmp>=time*14/18 )
 149   3      {P0=~Bin(01100110);  P2=~Bin(00000111);}
 150   3      else if(tmp<=time*5/18||tmp>=time*13/18 )
 151   3      {P0=~Bin(11000011);  P2=~Bin(00000111);}
 152   3      else if(tmp<=time*6/18||tmp>=time*12/18 )
 153   3      {P0=~Bin(10000011);  P2=~Bin(10000111);}
 154   3      else if(tmp<=time*7/18||tmp>=time*11/18 )
 155   3      {P0=~Bin(00000110);  P2=~Bin(11000111);}
 156   3      else if(tmp<=time*8/18||tmp>=time*10/18 )
 157   3      {P0=~Bin(00001100);  P2=~Bin(01100111);}
 158   3      else if(tmp<=time*10/18)
 159   3      {P0=~Bin(00011100);  P2=~Bin(00110111);}
 160   3      }//end if(心)
 161   2      
 162   2      
 163   2      
 164   2      
 165   2      //显示U
 166   2      else if(word%140<=140)
 167   2      { 
 168   3      tmp=count;
 169   3        if((tmp>=time*0/13&&tmp<=time*4/22||tmp>=time*18/22&&tmp<=time*22/22) )
 170   3      {P0=~Bin(11111111);  P2=~Bin(11100111);}
 171   3      else  if((tmp>=time*7/22&&tmp<=time*15/22))
 172   3      {P0=~Bin(00000000);  P2=~Bin(00111111);}
 173   3      else if(tmp>=time*4/22&&tmp<=time*7/22||tmp>=time*15/22&&tmp<=time*18/22)
 174   3      {P0=~Bin(00000000);  P2=~Bin(01110111);}
 175   3      else 
 176   3      {P0=~Bin(00000000);  P2=~Bin(00000111);}
 177   3      }//end if(U)
 178   2      
C51 COMPILER V7.50   MAIN                                                                  05/28/2008 00:33:49 PAGE 4   

 179   2      
 180   2      
 181   2      }//end for 
 182   1      }//end main


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   2156    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     29       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 + -