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

📄 muen_240128_function.lst

📁 液晶MGLS2401128TA的控制程序
💻 LST
字号:
C51 COMPILER V7.08   MUEN_240128_FUNCTION                                                  08/31/2005 02:48:48 PAGE 1   


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

line level    source

   1          #include <AT89X51.H>
   2          
   3          #include <intrins.h>
   4          #include <math.h>
   5          #define DATA_PORT P0
   6          
   7          sbit WR_PORT=P2^0 ;
   8          sbit RD_PORT=P2^1 ;
   9          sbit CE_PORT=P2^2 ;
  10          sbit CD_PORT=P2^3 ;
  11          
  12          
  13          //-------------delay the time---------//
  14          //50us
  15          void delay(unsigned int a)
  16          {
  17   1          unsigned int i,j ;
  18   1          for(i=0;i<a;i++)
  19   1          for(j=0;j<6;j++);
  20   1      }
  21          
  22          //--------- LGD Read the Appearance from the lGD-------------//
  23          unsigned char read_Appearance(void)
  24          {
  25   1          unsigned char temp ;
  26   1          CE_PORT=1 ;
  27   1          DATA_PORT=0XFF ;
  28   1          CE_PORT=0 ;
  29   1          CD_PORT=1 ;
  30   1          //READ CODE
  31   1          RD_PORT=0 ;
  32   1          temp=DATA_PORT ;
  33   1          RD_PORT=1 ;
  34   1          CE_PORT=1 ;
  35   1          //del the  Total line
  36   1          return temp ;
  37   1      }
  38          
  39          //--------LGD STA0-STA1--------//
  40          bit st00_st01(void)
  41          {
  42   1          unsigned char temp ;
  43   1          temp=read_Appearance();
  44   1          temp=temp&0x03 ;
  45   1          
  46   1          if(temp==0x03)return 1 ;
  47   1          
  48   1          return 0 ;
  49   1          
  50   1      }
  51          
  52          
  53          
  54          //----------LGD STA3--------//
  55          bit st03(void)
C51 COMPILER V7.08   MUEN_240128_FUNCTION                                                  08/31/2005 02:48:48 PAGE 2   

  56          {
  57   1          unsigned char temp ;
  58   1          temp=read_Appearance();
  59   1          temp=temp&0x08 ;
  60   1          
  61   1          if(temp==0x08)return 1 ;
  62   1          
  63   1          return 0 ;
  64   1          
  65   1      }
  66          /*
  67          //----------LGD STA2--------//
  68          bit st02(void)
  69          {
  70                  unsigned char temp;
  71          temp=read_Appearance();
  72          temp=temp&0x04;
  73          
  74          if(temp==0x04)return 1;
  75          
  76          return 0;
  77          
  78          }
  79          
  80          //---------LGD STA5--------//
  81          bit st05(void)
  82          {
  83          unsigned char temp;
  84          temp=read_Appearance();
  85          temp=temp&0x20;
  86          
  87          if(temp==0x20)return 1;
  88          
  89          return 0;
  90          
  91          }
  92          
  93          //--------LGD STA6--------//
  94          bit st06(void)
  95          {unsigned char temp;
  96          temp=read_Appearance();
  97          temp=temp&0x40;
  98          
  99          if(temp==0x40)return 1;
 100          
 101          return 0;
 102          
 103          }
 104          
 105          //--------LGD STA7-------//
 106          bit st07(void)
 107          {
 108          unsigned char temp;
 109          temp=read_Appearance();
 110          temp=temp&0x80;
 111          
 112          if(temp==0x80)return 1;
 113          
 114          return 0;
 115          
 116          
 117          }
C51 COMPILER V7.08   MUEN_240128_FUNCTION                                                  08/31/2005 02:48:48 PAGE 3   

 118          
 119          */
 120          //---------read data from the lgd--------//
 121          unsigned char read_from(void)
 122          {unsigned char temp;
 123   1      
 124   1              while(st00_st01()==0);
 125   1              CE_PORT=0;
 126   1              CD_PORT=0;//data 
 127   1              RD_PORT=0;      
 128   1              //temp1=DATA_PORT;
 129   1              temp=DATA_PORT; 
 130   1              RD_PORT=1;
 131   1              CE_PORT=1;
 132   1              return temp;
 133   1      }
 134          
 135          //------- Write 2 Number and 1 CODE to LCM ---------//
 136          void write_2_code(unsigned char a,unsigned char b,unsigned char c)
 137          {
 138   1          while(st00_st01()==0);
 139   1          CE_PORT=0 ;
 140   1          CD_PORT=0 ;
 141   1          //data      
 142   1          DATA_PORT=a ;
 143   1          WR_PORT=0 ;
 144   1          _nop_();
 145   1          WR_PORT=1 ;
 146   1          CE_PORT=1 ;
 147   1          
 148   1          while(st00_st01()==0);
 149   1          CE_PORT=0 ;
 150   1          CD_PORT=0 ;
 151   1          //data 
 152   1          DATA_PORT=b ;
 153   1          WR_PORT=0 ;
 154   1          _nop_();
 155   1          WR_PORT=1 ;
 156   1          CE_PORT=1 ;
 157   1          
 158   1          while(st00_st01()==0);
 159   1          CE_PORT=0 ;
 160   1          CD_PORT=1 ;
 161   1          //code 
 162   1          DATA_PORT=c ;
 163   1          WR_PORT=0 ;
 164   1          _nop_();
 165   1          WR_PORT=1 ;
 166   1          CE_PORT=1 ;
 167   1          
 168   1      }
 169          //---------write 1 data and 1 code  to the Lcm------//
 170          void write_1_code(unsigned char a,unsigned char c)
 171          {
 172   1          while(st00_st01()==0);
 173   1          CE_PORT=0 ;
 174   1          CD_PORT=0 ;
 175   1          //data 
 176   1          DATA_PORT=a ;
 177   1          WR_PORT=0 ;
 178   1          _nop_();
 179   1          WR_PORT=1 ;
C51 COMPILER V7.08   MUEN_240128_FUNCTION                                                  08/31/2005 02:48:48 PAGE 4   

 180   1          CE_PORT=1 ;
 181   1          
 182   1          while(st00_st01()==0);
 183   1          CE_PORT=0 ;
 184   1          CD_PORT=1 ;
 185   1          //code 
 186   1          DATA_PORT=c ;
 187   1          WR_PORT=0 ;
 188   1          _nop_();
 189   1          WR_PORT=1 ;
 190   1          CE_PORT=1 ;
 191   1          
 192   1      }
 193          //---------write 1 code to Lcm--------//
 194          void write_code(unsigned char c)
 195          {
 196   1          while(st00_st01()==0);
 197   1          CE_PORT=0 ;
 198   1          CD_PORT=1 ;
 199   1          //code 
 200   1          DATA_PORT=c ;
 201   1          WR_PORT=0 ;
 202   1          _nop_();
 203   1          WR_PORT=1 ;
 204   1          CE_PORT=1 ;
 205   1      }
 206          
 207          
 208          //-----------write data to lgd---------//
 209          void write_to(unsigned char a)
 210          {
 211   1          while(st00_st01()==0);
 212   1          CE_PORT=0 ;
 213   1          CD_PORT=0 ;
 214   1          //data 
 215   1          DATA_PORT=a ;
 216   1          WR_PORT=0 ;
 217   1          WR_PORT=1 ;
 218   1          CE_PORT=1 ;
 219   1      }
 220          
 221          //---------- START THE LGD-----------//
 222          void lcm_start(void)
 223          {
 224   1          //----setting the text head addr--------//
 225   1          write_2_code(0x00,0x00,0x21);
 226   1          //the light mark start
 227   1          write_2_code(0x00,0x00,0x40);
 228   1          //text start
 229   1          
 230   1          write_2_code(0x1e,0x00,0x41);
 231   1          //text with
 232   1          
 233   1          write_2_code(0x00,0x00,0x42);
 234   1          //graph start
 235   1          
 236   1          write_2_code(0x1e,0x00,0x43);
 237   1          //graph with
 238   1          
 239   1          write_code(0xa1);
 240   1          //the light mark look like
 241   1          
C51 COMPILER V7.08   MUEN_240128_FUNCTION                                                  08/31/2005 02:48:48 PAGE 5   

 242   1          write_code(0x80);
 243   1          // the text or graph
 244   1          
 245   1          write_code(0x98);
 246   1          //the show like
 247   1          
 248   1      }
 249          
 250          //--------------CLS THE LCM-----------------//
 251          void cls_lcm(void)
 252          {
 253   1          unsigned int i ;
 254   1          
 255   1          write_2_code(0x00,0x00,0x24);
 256   1          write_code(0xb0);
 257   1          for(i=0;i<5888;i++)
 258   1          {
 259   2              while(st03()==0);
 260   2              write_to(0x00);
 261   2              
 262   2          }
 263   1          write_code(0xb2);
 264   1      }


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