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

📄 gg.lst

📁 由单片机
💻 LST
字号:
C51 COMPILER V8.05a   GG                                                                   09/29/2007 12:19:38 PAGE 1   


C51 COMPILER V8.05a, COMPILATION OF MODULE GG
OBJECT MODULE PLACED IN gg.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE gg.c BROWSE DEBUG OBJECTEXTEND

line level    source

   1          #include <reg51.h>
   2          #include <intrins.h>
   3          #include <ADC0808.c>
   4          sbit DI=P2^2; // 数据\指令 选择
   5          sbit RW=P2^1; // 读\写 选择
   6          sbit E=P2^0; // 读\写使能
   7          sbit CS1=P2^4; // 片选1
   8          sbit CS2=P2^3; // 片选2
   9          sbit busy=P1^7;
  10          sbit jia=P3^7;
  11          sbit jian=P3^3;
  12          sbit jia1=P3^0;
  13          sbit jian1=P3^1;
  14          unsigned int i;
  15          unsigned char ye,lei,shu;
  16          unsigned char a[94];
  17          char code t[]={ 
  18                          
  19                                                                                                                                                                           
  20                                      0x00,0x00,0x08,0x00,0x04,0x00,0x02,0x00,0x01,0x80,0x40,0x60,0x80,0x00,0x7F,0xFF, //小
  21                          0x00,0x00,0x00,0x20,0x00,0x40,0x00,0x80,0x01,0x00,0x06,0x00,0x00,0x00,0x00,0x00,
  22          
  23                                          0x00,0x80,0x00,0x80,0x00,0x82,0x00,0x82,0x00,0x82,0x40,0x82,0x80,0x82,0x7F,0xE2, //子
  24                          0x00,0xA2,0x00,0x92,0x00,0x8A,0x00,0x86,0x00,0x80,0x00,0xC0,0x00,0x80,0x00,0x00,
  25                                                                                                                                                                                                           
  26                                          0x00,0x40,0x00,0x60,0x3F,0x5E,0x01,0x48,0x01,0x48,0xFF,0xFF,0x11,0x48,0x21,0x4C, //制
  27                          0x1F,0x68,0x00,0x40,0x07,0xF8,0x40,0x00,0x80,0x00,0x7F,0xFF,0x00,0x00,0x00,0x00,
  28                                          
  29                                          0x00,0x80,0x00,0x40,0x00,0x20,0xFF,0xF8,0x00,0x87,0x00,0x40,0x00,0x30,0x00,0x0F, //作
  30                          0xFF,0xF8,0x08,0x88,0x08,0x88,0x08,0xC8,0x0C,0x88,0x08,0x0C,0x00,0x08,0x00,0x00, 
  31                                          };
  32          
  33          
  34                                    
  35          void checkstate()
  36          {
  37   1              //bit dat;
  38   1              DI=0;
  39   1              RW=1;
  40   1              //P1=0x00;
  41   1              do
  42   1              {
  43   2                E=1; 
  44   2                E=0;
  45   2                                              //仅当第7位为0时才可操作(判别busy信号)
  46   2              }while(busy==1);
  47   1      }
  48             void writecommand(unsigned char command)     //写命令
  49          {
  50   1              checkstate();
  51   1              DI=0;
  52   1              RW=0;
  53   1              P1=command;
  54   1              E=1;
  55   1              E=0;
C51 COMPILER V8.05a   GG                                                                   09/29/2007 12:19:38 PAGE 2   

  56   1              }
  57           void writedate(unsigned char date)             //写数据
  58          {
  59   1         checkstate();
  60   1         DI=1; 
  61   1         RW=0;
  62   1         P1=date;
  63   1         E=1; 
  64   1         E=0; 
  65   1      }
  66          
  67           void pianxuan(unsigned int i)
  68           {
  69   1        if(i==1) 
  70   1        CS1=0,CS2=1;
  71   1        if(i==2)
  72   1        CS1=1,CS2=0;
  73   1        if(i==3)
  74   1        CS1=0,CS2=0;
  75   1        }
  76            void cleanscreen()                                             //清屏
  77          {
  78   1              unsigned char page,i;
  79   1              for(page=0xb8;page<0xc0;page++)
  80   1              {
  81   2                      writecommand(page);
  82   2                      writecommand(0x40);
  83   2                      for(i=0;i<64;i++)
  84   2                      writedate(0x00);
  85   2              }
  86   1      
  87   1      }
  88          void init(void)   //开显示,起始行0行
  89          {       
  90   1          writecommand(0xc0);
  91   1              writecommand(0x3f);
  92   1      }
  93          void delay_50us(uint t)
  94          {
  95   1       uchar j;  
  96   1       for(;t>0;t--)   
  97   1        for(j=19;j>0;j--) 
  98   1         ;
  99   1      }
 100           void shuju()
 101           {
 102   1        pianxuan(i);
 103   1        writecommand(ye);
 104   1        writecommand(lei);
 105   1        writedate(shu);
 106   1        }
 107           void qing()
 108           {
 109   1         uchar i;
 110   1        for(i=0xb8;i<=0xbf;i++)
 111   1        {
 112   2          ye=i;
 113   2              shu=0x00;
 114   2              shuju();
 115   2              }
 116   1        }
 117           void main()
C51 COMPILER V8.05a   GG                                                                   09/29/2007 12:19:38 PAGE 3   

 118           {
 119   1       
 120   1              
 121   1          uint r,j,g=0,q,dianya=1,k,p;
 122   1          uchar U,m,l;
 123   1              pianxuan(3);
 124   1          cleanscreen();
 125   1          init();
 126   1              pianxuan(2);
 127   1              
 128   1              l=0xb8;
 129   1              for(k=0;k<4;k++,l=l+0x02)
 130   1              {
 131   2              ye=l;
 132   2              lei=0x70;
 133   2              for(r=0;r<16;r++)
 134   2         {
 135   3          shu=t[2*r+1+32*k];
 136   3              shuju();
 137   3              lei++;
 138   3              }
 139   2              ye=l+0x01;
 140   2              lei=0x70;
 141   2              for(r=0;r<16;r++)
 142   2         {
 143   3          shu=t[2*r+32*k];
 144   3              shuju();
 145   3              lei++;
 146   3              }
 147   2              }
 148   1              
 149   1              
 150   1        while(1)
 151   1        {
 152   2      uchar d1,d2,d3,d4,d5;
 153   2      aaa:do
 154   2              {
 155   3              adc();
 156   3               }while((AD!=128)&&(AD!=129)&&(AD!=130));
 157   2          U=AD;
 158   2              adc();
 159   2              if(U>AD)
 160   2              goto aaa;
 161   2      while(jia==0)
 162   2      {
 163   3       while(jia==0);
 164   3       g=g+1;
 165   3       }
 166   2       while(jian==0)
 167   2      {
 168   3       while(jian==0);
 169   3       if(g!=0) g=g-1;
 170   3       }
 171   2       while(jia1==0)
 172   2      {
 173   3       while(jia1==0);
 174   3       dianya=dianya+1;
 175   3       }
 176   2       while(jian1==0)
 177   2      {
 178   3       while(jian1==0);
 179   3       if(dianya!=1) dianya=dianya-1;
C51 COMPILER V8.05a   GG                                                                   09/29/2007 12:19:38 PAGE 4   

 180   3       }
 181   2       for(j=0;j<94;j++) //AD采样
 182   2       {
 183   3        adc();
 184   3        a[j]=AD;
 185   3        delay_50us(g);
 186   3        }
 187   2          lei=0x40;
 188   2          for(r=0,j=0;r<94;r++,j++)
 189   2              {
 190   3              if(j<64) i=1;
 191   3              if(j==64) lei=0x40;
 192   3              if(j>=64)i=2;
 193   3              qing();                //清掉之前的内容
 194   3          AD=a[j]*0.196/dianya;  //计算在12864的电压值
 195   3          if(AD<=7)       ye=0xbf,shu=(0x80>>AD);
 196   3              else if(AD<=15) ye=0xbe,shu=0x80>>(AD-8);
 197   3          else if(AD<=23) ye=0xbd,shu=0x80>>(AD-16);
 198   3          else if(AD<=31) ye=0xbc,shu=0x80>>(AD-24);
 199   3          else if(AD<=39) ye=0xbb,shu=0x80>>(AD-32);
 200   3          else if(AD<=47) ye=0xba,shu=0x80>>(AD-40);
 201   3          else if(AD<=55) ye=0xb9,shu=0x80>>(AD-48);
 202   3              else if(AD<=63) ye=0xb8,shu=0x80>>(AD-56);
 203   3         if(r==0)
 204   3              {
 205   4              d1=shu;
 206   4              d2=ye;
 207   4              }
 208   3              if(r!=0)
 209   3              {
 210   4               d3=shu;
 211   4               d4=ye;
 212   4               if(ye==d2)
 213   4               {
 214   5                if(shu>d1)
 215   5               {
 216   6               d5=shu;
 217   6               d5=d5>>1;
 218   6               while(d5!=d1)
 219   6               {d5=d5>>1;
 220   7               shu=shu|(shu>>1);}
 221   6               }
 222   5               if(shu<d1)
 223   5               {
 224   6               d5=shu;
 225   6               d5=d5<<1;
 226   6               while(d5!=d1)
 227   6               {d5=d5<<1;shu=shu|(shu<<1);} 
 228   6               }
 229   5              }
 230   4       
 231   4          if(ye<d2)
 232   4               {
 233   5                   for(q=0;q<7;q++) 
 234   5                   {
 235   6                        shu=shu|(shu<<1);
 236   6                        } 
 237   5                        shuju();
 238   5                        ye++;
 239   5                        while(ye<d2) {shu=0xff,shuju(),ye++;}
 240   5                        if(ye==d2){
 241   6                                    shu=0x01;
C51 COMPILER V8.05a   GG                                                                   09/29/2007 12:19:38 PAGE 5   

 242   6                                                if(shu<d1)
 243   6                              {
 244   7                               d5=shu;
 245   7                               d5=d5<<1;
 246   7                               while(d5!=d1)
 247   7                               {d5=d5<<1;shu=shu|(shu<<1);} 
 248   7                                }
 249   6                                                }
 250   5             }
 251   4                if(ye>d2)
 252   4               {
 253   5                   for(q=0;q<7;q++) 
 254   5                      {
 255   6                            shu=shu|(shu>>1);
 256   6                           }
 257   5                        shuju();
 258   5                        ye--;
 259   5                        while(ye>d2) {shu=0xff,shuju(),ye--;}
 260   5                        if(ye==d2){
 261   6                                    shu=0x80;
 262   6                                                if(shu>d1)
 263   6                                 {
 264   7                               d5=shu;
 265   7                               d5=d5>>1;
 266   7                               while(d5!=d1)
 267   7                               {d5=d5>>1;shu=shu|(shu>>1);} 
 268   7                                  }
 269   6                                               } 
 270   5            }
 271   4                }
 272   3              if(r!=0)
 273   3              {
 274   4               d1=d3;
 275   4               d2=d4;
 276   4               }
 277   3          shuju();
 278   3          if(lei!=0x7f) lei++;
 279   3              }
 280   2               }
 281   1               }
*** WARNING C280 IN LINE 121 OF GG.C: 'p': unreferenced local variable
*** WARNING C280 IN LINE 122 OF GG.C: 'm': unreferenced local variable
 282                  
 283                    
 284             
 285                  


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =   1277    ----
   CONSTANT SIZE    =    128    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =    101      18
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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