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

📄 lcm.lst

📁 Keil 8051 C example RS232 to I2c
💻 LST
字号:
C51 COMPILER V7.07   LCM                                                                   05/17/2006 03:13:55 PAGE 1   


C51 COMPILER V7.07, COMPILATION OF MODULE LCM
OBJECT MODULE PLACED IN .\Output\LCM.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE LCM.C BROWSE DEBUG OBJECTEXTEND PRINT(.\LST\LCM.lst) OBJECT(.\Output\LCM.ob
                    -j)

stmt level    source

   1          
   2          #include <stdio.h>  
   3          //#include <at89x52.H> 
   4          #include <reg54.h>
   5          #include <intrins.h>
   6          #include "SystemEvent.h"
   7          #include "ExtVar.h"
   8          #include "function.h"
   9          //extern idata unsigned int _Counter; 
  10          idata unsigned char _Idx;
  11          idata unsigned char _px;
  12          code char _CROM[]={" Cortez DTV"};
  13          code char _PROM[]={"EVB v1 "};
  14          code char _BinX[]={"Amtran"};
  15          code char _Type[]={"2006"};
  16          
  17          
  18          
  19          unsigned char ReadLCM(void);
  20          void WriteLCMControl(unsigned char);
  21          void WriteLCMData(unsigned char);
  22          void PrintAChar(unsigned char,unsigned char);
  23          void PrintAShortInt(unsigned char,unsigned char);
  24          void PrintAInt(unsigned int,unsigned char);
  25          void PrintAString(unsigned char *,int,unsigned char);
  26          
  27          sbit _RS=P2^0x02;
  28          sbit _RW=P2^0x01;
  29          sbit _EN=P2^0x00;
  30          
  31           
  32          //extern unsigned int _sec,_min,_hour;
  33           
  34          
  35          //extern unsigned int _secx,_minx,_hourx;
  36          
  37          
  38          void PrintAChar(unsigned char _stx,unsigned char _Offset){   
  39   1               while((ReadLCM()&0x80)==0x80); 
  40   1                   
  41   1                WriteLCMControl(_Offset+0x80);
  42   1                while((ReadLCM()&0x80)==0x80); 
  43   1             
  44   1               WriteLCMData(_stx);
  45   1                while((ReadLCM()&0x80)==0x80); 
  46   1      }
  47          
  48          void PrintTestPage(void){
  49   1      
  50   1      
  51   1      
  52   1      //  char buf[0x10];
  53   1        
  54   1      
C51 COMPILER V7.07   LCM                                                                   05/17/2006 03:13:55 PAGE 2   

  55   1        //    _Counter++;
  56   1      
  57   1             while((ReadLCM()&0x80)==0x80); 
  58   1           
  59   1                _px=0;
  60   1                   PrintAString(_CROM,(sizeof(_CROM)-1),_px);
  61   1                   _px+=sizeof(_CROM)-2;
  62   1        
  63   1                   _px=0x0a;
  64   1                   PrintAString(_PROM,(sizeof(_PROM)-1),_px);
  65   1                   _px+=sizeof(_PROM)-2;
  66   1                   PrintAInt(0x05,_px);
  67   1      
  68   1                               _px+=5;
  69   1                   PrintAChar('F',_px);
  70   1       
  71   1       }
  72          
  73           
  74          void PrintAInt(unsigned int _XData,unsigned char _Offset){
  75   1      unsigned int _ix;
  76   1      unsigned int _XD,_XC;
  77   1      unsigned char _jx;
  78   1      
  79   1                   _XD=_XData;
  80   1            
  81   1                while((ReadLCM()&0x80)==0x80);   
  82   1               
  83   1      
  84   1           for(_ix=0;_ix<0x04;_ix++){
  85   2      
  86   2                WriteLCMControl(_Offset+0x80+_ix);
  87   2                while((ReadLCM()&0x80)==0x80); 
  88   2               
  89   2               _XC=(_XD&0xf000);
  90   2                       _jx=(unsigned char)(_XC>>12);
  91   2               if(_jx>0x09){ _jx-=0x0a; _jx+='a'; } 
  92   2               else _jx+='0';
  93   2      
  94   2               WriteLCMData(_jx);
  95   2               while((ReadLCM()&0x80)==0x80); 
  96   2               _XD<<=4;
  97   2               }
  98   1      
  99   1      }
 100          
 101           
 102          void PrintAShortInt(unsigned char _XData,unsigned char _Offset){
 103   1      unsigned int _ix;
 104   1      unsigned int _XD,_XC;
 105   1      unsigned char _jx;
 106   1      
 107   1                   _XD=_XData;
 108   1            
 109   1                while((ReadLCM()&0x80)==0x80);   
 110   1               
 111   1      
 112   1           for(_ix=0;_ix<0x02;_ix++){
 113   2      
 114   2                WriteLCMControl(_Offset+0x80+_ix);
 115   2                while((ReadLCM()&0x80)==0x80); 
 116   2               
C51 COMPILER V7.07   LCM                                                                   05/17/2006 03:13:55 PAGE 3   

 117   2               _XC=(_XD&0xf0);
 118   2                       _jx=(unsigned char)(_XC>>4);
 119   2               if(_jx>0x09){ _jx-=0x0a; _jx+='a'; } 
 120   2               else _jx+='0';
 121   2      
 122   2               WriteLCMData(_jx);
 123   2               while((ReadLCM()&0x80)==0x80); 
 124   2               _XD<<=4;
 125   2               }
 126   1      
 127   1      }
 128          
 129           
 130          void PrintAString(unsigned char *_stx,int _ax,unsigned char _Offset){
 131   1      unsigned int _ix;
 132   1         
 133   1                while((ReadLCM()&0x80)==0x80);   
 134   1               
 135   1           for(_ix=0;_ix<_ax;_ix++){
 136   2      
 137   2                WriteLCMControl(_Offset+0x80+_ix);
 138   2                while((ReadLCM()&0x80)==0x80); 
 139   2             
 140   2               WriteLCMData(*(_stx+_ix));
 141   2               while((ReadLCM()&0x80)==0x80); 
 142   2               
 143   2               }
 144   1      
 145   1      }
 146          /*
 147          void PrintAChar(unsigned char _stx,unsigned char _Offset){   
 148                    while((ReadLCM()&0x80)==0x80);   
 149                       
 150                    WriteLCMControl(_Offset+0x80);
 151                    while((ReadLCM()&0x80)==0x80); 
 152                 
 153                   WriteLCMData(_stx);
 154                   while((ReadLCM()&0x80)==0x80); 
 155          }
 156          
 157          */
 158          
 159           
 160          
 161          unsigned char ReadLCM(void){
 162   1      unsigned char _xbuf;
 163   1       
 164   1       
 165   1            _RS=0;
 166   1            _RW=1;
 167   1                _EN=1;
 168   1           P0=0xff;
 169   1           _xbuf=P0; 
 170   1            _EN=0;
 171   1                _RS=1;
 172   1            _RW=1;
 173   1       
 174   1      
 175   1        
 176   1                  
 177   1           return(_xbuf);
 178   1      }
C51 COMPILER V7.07   LCM                                                                   05/17/2006 03:13:55 PAGE 4   

 179          
 180          void WriteLCMControl(unsigned char _xbuf){
 181   1      
 182   1           
 183   1            _RW=0;
 184   1                _RS=0;
 185   1      
 186   1                _EN=1;
 187   1      
 188   1            P0=_xbuf; 
 189   1      
 190   1            _EN=0;
 191   1      
 192   1                _RW=1;
 193   1                _RS=1;
 194   1      
 195   1       
 196   1      }
 197          
 198          void WriteLCMData(unsigned char _xbuf){
 199   1       
 200   1      
 201   1            _RW=0;
 202   1            _RS=1;   
 203   1                _EN=1;
 204   1           P0=_xbuf; 
 205   1            _EN=0;
 206   1            _RW=1;
 207   1            _RS=1;    
 208   1       
 209   1      }
 210          
 211          
 212          
 213          void LCM_Init(void){  
 214   1      unsigned char _ix;
 215   1       
 216   1             while((ReadLCM()&0x80)==0x80);  // wait LCD busy  
 217   1             WriteLCMControl(0x38);          // write LCM control mode 
 218   1                 while((ReadLCM()&0x80)==0x80);  // wait LCD busy        
 219   1               WriteLCMControl(0x0c);                 // write LCM control mode 
 220   1             while((ReadLCM()&0x80)==0x80);  // wait LCD busy   
 221   1               WriteLCMControl(0x06);                 // write LCM control mode 
 222   1                 while((ReadLCM()&0x80)==0x80);  // wait LCD busy  
 223   1       
 224   1           for(_ix=0;_ix<20;_ix++){
 225   2                 WriteLCMData((unsigned char)_ix+0x80);       
 226   2      
 227   2                 WriteLCMData((unsigned char)_ix+0xc0);
 228   2                 while( (ReadLCM()&0x80)==0x80);  
 229   2               }
 230   1      
 231   1          WriteLCMControl(1);
 232   1              //     _px=0;
 233   1              //     PrintAString(_CROM,(sizeof(_CROM)-1),_px);
 234   1      
 235   1              //_px=0x40;
 236   1              //     PrintAString(_BinX,(sizeof(_BinX)-1),_px);
 237   1                      _px=0x48;
 238   1              //      PrintAInt(0x1234,_px);  // for test
 239   1                      PrintAShortInt(0x08,_px+6);  // for test
 240   1              }
C51 COMPILER V7.07   LCM                                                                   05/17/2006 03:13:55 PAGE 5   

 241          
 242          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    562    ----
   CONSTANT SIZE    =     32    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----      20
   IDATA SIZE       =      2    ----
   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 + -