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

📄 text1.lst

📁 单片机方面的程序
💻 LST
字号:
C51 COMPILER V7.50   TEXT1                                                                 05/08/2007 23:08:01 PAGE 1   


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

line level    source

   1          #include <REGX52.H>
   2          
   3          
   4              
   5          #define uchar unsigned char
   6          idata char flag0 ;
   7          idata char flag1 ;
   8          idata char flag2 ;
   9          idata char flag3 ;
  10          idata char flag4 ;
  11          idata char flag5 ;
  12          idata char flag6 ;
  13          idata char flag7 ;
  14          
  15          sbit RS=P2^3;
  16          sbit RW=P2^4;
  17          sbit LCDE=P2^5;
  18          sbit big=P3^2;
  19          sbit fd=P3^3;
  20          
  21          unsigned char line1[16],line2[16];
  22          unsigned char code cgram1[64]={0x00,0x1f,0x12,0x09,0x1f,0x11,0x01,0x0f,
  23          0x1e,0x04,0x04,0x08,0x1f,0x01,0x00,0x1e,
  24          0x02,0x03,0x06,0x05,0x04,0x09,0x09,0x12,
  25          0x00,0x1c,0x04,0x08,0x10,0x18,0x04,0x07,
  26          0x00,0x0f,0x09,0x09,0x0f,0x09,0x09,0x0f,0x00,0x1c,0x04,0x04,0x1c,0x04,0x04,0x1c,
  27          0x00,0x04,0x14,0x14,0x14,0x04,0x04,0x03,0x00,0x12,0x13,0x11,0x01,0x04,0x04,0x1c};
  28          
  29          
  30          void delay5ms()
  31          {
  32   1       register int i;
  33   1       for (i=0;i<1000;i++)
  34   1       ;
  35   1      }
  36          
  37          void delay50us()
  38          {
  39   1       register int i;
  40   1       for (i=0;i<20;i++)
  41   1       ;
  42   1      }
  43          
  44          wr_com(unsigned char comm)
  45          {
  46   1        LCDE=0;
  47   1        RS=0;
  48   1        RW=0;
  49   1        LCDE=1;
  50   1        P0=comm;
  51   1        RS=0;
  52   1        RW=0;
  53   1        LCDE=0;
  54   1      }
  55          
C51 COMPILER V7.50   TEXT1                                                                 05/08/2007 23:08:01 PAGE 2   

  56          wr_data(unsigned char dat)
  57          {
  58   1        LCDE=0;
  59   1        RS=0;
  60   1        RW=0;
  61   1        RS=1;
  62   1        RW=0;
  63   1        LCDE=1;
  64   1        P0=dat;
  65   1          LCDE=0;
  66   1        RS=0;
  67   1        RW=0;
  68   1      }
  69          
  70          
  71          unsigned char rd_bf()
  72          {
  73   1        unsigned char i;
  74   1        P0=0xff;
  75   1        LCDE=0;
  76   1        RS=0;
  77   1        RW=0;
  78   1        RS=0;
  79   1        RW=1;
  80   1        LCDE=1;
  81   1        i=P0;
  82   1          LCDE=0;
  83   1        return(i);
  84   1      }
  85           
  86          void init()
  87          {
  88   1       unsigned char in,i;
  89   1       wr_com(0x30);
  90   1       delay5ms();
  91   1       wr_com(0x30);
  92   1       delay5ms();
  93   1       wr_com(0x30);
  94   1       delay5ms();
  95   1       in=rd_bf();
  96   1       delay5ms();
  97   1       wr_com(0x01);
  98   1       delay5ms();
  99   1       in=rd_bf();
 100   1       delay5ms();
 101   1       wr_com(0x06);
 102   1       delay5ms();
 103   1       in=rd_bf();
 104   1       delay50us();
 105   1       wr_com(0x38);
 106   1       delay50us();
 107   1       in=rd_bf();
 108   1       delay50us();
 109   1       wr_com(0x0c);
 110   1       delay50us();
 111   1       in=rd_bf();
 112   1       delay50us();
 113   1       
 114   1       wr_com(0x40);  //set cgram address
 115   1       delay50us();
 116   1       in=rd_bf();
 117   1       delay50us();
C51 COMPILER V7.50   TEXT1                                                                 05/08/2007 23:08:01 PAGE 3   

 118   1       for(i=0;i<64;i++)
 119   1       {
 120   2        wr_data(cgram1[i]);  //display "0"
 121   2        delay50us();
 122   2        in=rd_bf();
 123   2       }
 124   1       
 125   1       
 126   1      
 127   1      
 128   1      }
 129          
 130          
 131          display_162()
 132          {
 133   1         unsigned char in,i;
 134   1        wr_com(0x80);  //set ram address
 135   1        delay50us();
 136   1        in=rd_bf();
 137   1        delay50us();
 138   1        for(i=0;i<16;i++)
 139   1        {
 140   2         wr_data(line1[i]);  //display "0"
 141   2         delay50us();
 142   2         in=rd_bf();
 143   2        }
 144   1        in=rd_bf();
 145   1        delay50us();
 146   1        wr_com(0xc0);
 147   1        delay50us();
 148   1        in=rd_bf();
 149   1        delay50us();
 150   1        for(i=0;i<16;i++)
 151   1        {
 152   2         wr_data(line2[i]);  //display "0"
 153   2         delay50us();
 154   2         in=rd_bf();
 155   2        }
 156   1      }
 157          main()
 158          {
 159   1       unsigned char in,i,da;
 160   1       delay5ms();
 161   1       delay5ms();
 162   1       delay5ms();
 163   1       delay5ms();
 164   1          
 165   1        
 166   1       init(); 
 167   1      
 168   1       while(1)
 169   1       {
 170   2        if(fd==1)
 171   2        {
 172   3          line1[0]=0x20;
 173   3          line1[1]=0;  //display "爱思"
 174   3          line1[2]=1;
 175   3          line1[3]=4;
 176   3          line1[4]=5;
 177   3          line1[5]=0x20;
 178   3          line1[6]=0;  //display "爱思"
 179   3          line1[7]=1;
C51 COMPILER V7.50   TEXT1                                                                 05/08/2007 23:08:01 PAGE 4   

 180   3          line1[8]=4;
 181   3          line1[9]=5;
 182   3          line1[10]=0x20;
 183   3          line1[11]=0;  //display "爱思"
 184   3          line1[12]=1;
 185   3          line1[13]=4;
 186   3          line1[14]=5;
 187   3          line1[15]=0x20;
 188   3          
 189   3          line2[0]=0x20;
 190   3          line2[1]=2;  //display "爱思"
 191   3          line2[2]=3;
 192   3          line2[3]=6;
 193   3          line2[4]=7;
 194   3          line2[5]=0x20;
 195   3          line2[6]=2;  //display "爱思"
 196   3          line2[7]=3;
 197   3          line2[8]=6;
 198   3          line2[9]=7;
 199   3          line2[10]=0x20;
 200   3          line2[11]=2;  //display "爱思"
 201   3          line2[12]=3;
 202   3          line2[13]=6;
 203   3          line2[14]=7;
 204   3          line2[15]=0x20;
 205   3         
 206   3        } 
 207   2       else if(big==1){
 208   3        da=0x41;
 209   3        for(i=0;i<16;i++)
 210   3        {
 211   4         line1[i]=da;
 212   4         da++; 
 213   4        }
 214   3        
 215   3        
 216   3        da=0x51;
 217   3        for(i=0;i<16;i++)
 218   3        {
 219   4         line2[i]=da;
 220   4         da++; 
 221   4        }
 222   3       }
 223   2       else
 224   2       {
 225   3        da=0x61;
 226   3        for(i=0;i<16;i++)
 227   3        {
 228   4         line1[i]=da;
 229   4         da++; 
 230   4        }
 231   3        
 232   3        
 233   3        da=0x71;
 234   3        for(i=0;i<16;i++)
 235   3        {
 236   4         line2[i]=da;
 237   4         da++; 
 238   4        }
 239   3       }
 240   2       display_162(); 
 241   2       }
C51 COMPILER V7.50   TEXT1                                                                 05/08/2007 23:08:01 PAGE 5   

 242   1      }
*** WARNING C280 IN LINE 159 OF TEXT1.C: 'in': unreferenced local variable


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    415    ----
   CONSTANT SIZE    =     64    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =     32       1
   IDATA SIZE       =      8    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


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

⌨️ 快捷键说明

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