cm240128.lst

来自「C8051ucos源码」· LST 代码 · 共 241 行

LST
241
字号
C51 COMPILER V8.02   CM240128                                                              01/09/2009 16:20:59 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE CM240128
OBJECT MODULE PLACED IN CM240128.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE program\CM240128.C LARGE BROWSE DEBUG OBJECTEXTEND PRINT(.\CM240128.lst) OB
                    -JECT(CM240128.obj)

line level    source

   1          
   2          #include "c8051F020.h"
   3          #include "CM240128.H"
   4          #include <absacc.h>
   5          #include <intrins.h>
   6          #include <string.h>
   7          
   8          #define uchar unsigned char 
   9          
  10          #define  lcd_rs      P3_0
  11          #define  lcd_wr      P3_1
  12          #define  lcd_rd      P3_2
  13          #define  lcd_cs1     P3_3
  14          #define  lcd_cs2     P3_4
  15          #define  lcd_busy    P3_5 
  16          #define  lcd_int         P3_6
  17          #define  lcd_rst     P3_7
  18          
  19          #define   DataIo     P2
  20          
  21          #define  LcdWait()   _nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_
             -();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_
             -();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();_nop_();
  22          
  23          code unsigned char IniReg[]=  {   0,   1,   2,   3,0x10,0x11,0x12,0x21,0x31,0x41,0x51,0x20,0x30,0x40,0x50,
             -0x60,0x61,0x70,0x71,0x72,0x80,0x81,0x91,0x90,0xA0,0xA1,0xA2,0xA3,0xB0,0xB1,0xC0,0xC1,0xC8,0xC9,0xCA,0xD0,0xE0,0xF0,0xF1,
             -0x81};
  24          code unsigned char  IniData[]={0xC9,0xF0,0x10,0x80,0x6B,   0,0x91,0x1D,0x7F,   0,   0,0x1D,0x7F,   0,   0,
             -   0,   0,   0,   0,0x9F,0xAA,   0,   0,0x0F,0x11,   0,   0,   0,0x27,0xEF,0x00,0x0A,0x80,0x80,   0,0x80,   0,0xA0,0x0F,
             -0x04}; 
  25          
  26          //--------------------------------------------------------------------------------------------------------
             -----------------------
  27          void Lcd_WRReg(uchar regnada) 
  28          { 
  29   1          DataIo  = regnada; 
  30   1          lcd_cs1 = 0; // chip enable. 
  31   1          lcd_rd  = 1; // 
  32   1          lcd_rs  = 0; // rs = 0; 
  33   1          LcdWait();
  34   1          lcd_wr  = 0; // wr = 0; 
  35   1          LcdWait();
  36   1          lcd_wr  = 1; // wr = 1; 
  37   1          LcdWait();
  38   1          lcd_rs  = 1; // rs = 1; 
  39   1          lcd_cs1 = 1; // chip disable. 
  40   1      }                                                
  41          //--------------------------------------------------------------------------------------------------------
             -----------------------
  42          void Lcd_RegWrite(uchar regname,uchar regdata)              //写资料到缓存器 
  43          { 
  44   1          Lcd_WRReg(regname); 
  45   1              LcdWait();
  46   1          Lcd_WRReg(regdata); 
C51 COMPILER V8.02   CM240128                                                              01/09/2009 16:20:59 PAGE 2   

  47   1      }                       
  48          //--------------------------------------------------------------------------------------------------------
             -----------------------
  49          void Lcd_WRData(uchar wrdata)                               //写资料到DDRAM 
  50          { 
  51   1      
  52   1          while(lcd_busy == 1); 
  53   1      
  54   1          DataIo = wrdata; 
  55   1          lcd_cs1 =0; // chip enable. 
  56   1          lcd_rd = 1; // 
  57   1          lcd_rs = 1; // rs = 1; 
  58   1              LcdWait();
  59   1          lcd_wr = 0; // wr = 0; 
  60   1              LcdWait();
  61   1          lcd_wr = 1; // wr = 1; 
  62   1              LcdWait();
  63   1          lcd_rs = 1; // rs = 1; 
  64   1          lcd_cs1 =1; // chip disable. 
  65   1      
  66   1      } 
  67          //--------------------------------------------------------------------------------------------------------
             -----------------------
  68          /*
  69          uchar Lcd_ReadReg(uchar regname)                            //读缓存器 
  70          { 
  71              uchar reg_rddata; 
  72            
  73              Lcd_WRReg(regname); 
  74           
  75              DataIo = 0xff; 
  76              lcd_cs1 =0; // chip enable. 
  77              lcd_wr = 1; // wr = 1; 
  78              lcd_rs = 0; // rs = 0; 
  79              lcd_rd = 0; // rd = 0;  
  80              reg_rddata = DataIo; 
  81              lcd_rd = 1; // rd = 1; 
  82              lcd_rs = 1; // rs = 1; 
  83              lcd_cs1 =1; // chip disable. 
  84              return reg_rddata;          
  85            
  86          } 
  87          */
  88          //--------------------------------------------------------------------------------------------------------
             -----------------------
  89          
  90          void LcdDelay(unsigned long val)
  91          {
  92   1              while (val--);
  93   1      }
  94          
  95          /************************************************************************
  96          函数功能:       液晶初始化函数
  97          入口参数:       无
  98          出口参数:       无
  99          ************************************************************************/
 100          void Lcd_Init(void)
 101          {
 102   1              unsigned char bI;
 103   1      
 104   1      
 105   1              lcd_rst = 1;
C51 COMPILER V8.02   CM240128                                                              01/09/2009 16:20:59 PAGE 3   

 106   1              lcd_rst = 0;
 107   1              LcdDelay(100000); 
 108   1              lcd_rst = 1; 
 109   1              LcdDelay(10000); 
 110   1         
 111   1          for(bI = 0; bI<sizeof(IniReg); bI++)
 112   1          {
 113   2              Lcd_RegWrite(IniReg[bI],IniData[bI]);
 114   2          }
 115   1          
 116   1      //    Lcd_RegWrite(0,0x20);
 117   1      //    Lcd_RegWrite(0x20,0x1d);                                /*设定显示视窗和工作视窗*/
 118   1      //    Lcd_RegWrite(0x21,0x1d);
 119   1      //    Lcd_RegWrite(0x30,0x7f);
 120   1      //    Lcd_RegWrite(0x31,0x7f);
 121   1      //    Lcd_RegWrite(0x40,0);
 122   1      //    Lcd_RegWrite(0x41,0);
 123   1      //    Lcd_RegWrite(0x50,0);
 124   1      //    Lcd_RegWrite(0x51,0);
 125   1                                                                                            
 126   1      //    Lcd_RegWrite(0xE0,0x45);                                /* 清屏 */
 127   1      //    Lcd_RegWrite(0xF0,0x88);                                                                            
             -      
 128   1          
 129   1      //    Delay(1);                                  
 130   1          
 131   1      //    Lcd_RegWrite(0,0xC9);                                   /*系统工作方式*/
 132   1      //    Lcd_RegWrite(1,2);                                      /*系统时钟8MHZ*/
 133   1      //    Lcd_RegWrite(0x90,0x0F);                                /*设定屏幕刷新周期*/
 134   1      //    Lcd_RegWrite(0x10,0xff);                                /*光标*/
 135   1          
 136   1      //    Lcd_RegWrite(0x60,0);                                   /*光标位置*/
 137   1      //    Lcd_RegWrite(0x70,0);  
 138   1         
 139   1      //      Lcd_RegWrite(0,0x20);
 140   1          Lcd_RegWrite(0x10,0x2b);
 141   1          Lcd_RegWrite(0,0xcd);
 142   1          Lcd_RegWrite(0x60,0);                                   /*光标位置*/
 143   1          Lcd_RegWrite(0x70,0);  
 144   1              //for (bI=0; bI<255 ; bI++)
 145   1              //{
 146   1              //      Lcd_WRData(0x63);
 147   1              //}
 148   1          
 149   1      
 150   1      }
 151          //------------------------------------------------------------------------------
 152          void SetCurrLoc(unsigned char x,unsigned char y)
 153          {
 154   1      unsigned int i;
 155   1              Lcd_RegWrite(0x60,x);  /*光标位置*/
 156   1          Lcd_RegWrite(0x70,y); 
 157   1      for(i=0;i<1000;i++);
 158   1      }
 159          //------------------------------------------------------------------------------
 160          void ClrDisplay(void)//清屏幕
 161          {
 162   1              Lcd_Init();
 163   1              Lcd_RegWrite(0xf0,0xa8);
 164   1      }
 165          //------------------------------------------------------------------------------
 166          /*
C51 COMPILER V8.02   CM240128                                                              01/09/2009 16:20:59 PAGE 4   

 167          void DisplayLine(unsigned char *pbuf,unsigned char len)
 168          {
 169                  while(len--)
 170                          Lcd_WRData(*pbuf++);
 171          }
 172          */
 173          //------------------------------------------------------------------------------
 174          void DisplayFill(unsigned char buf,unsigned char len)
 175          {
 176   1              while(len--)
 177   1                      Lcd_WRData(buf);
 178   1      }
 179          //------------------------------------------------------------------------------
 180          void DisplayStr(unsigned char *pbuf,unsigned char maxcnt)
 181          {
 182   1              while((*pbuf!=0)&&(maxcnt--!=0))
 183   1                      Lcd_WRData(*pbuf++);
 184   1      }
 185          //------------------------------------------------------------------------------
 186          //拼音输入法显示函数
 187          //pbuf 要显示的字符串
 188          //maxcnt 最多反白显示的字符数
 189          
 190          void DisplayPYStr(unsigned char *pbuf,unsigned char maxcnt)
 191          {
 192   1      
 193   1              Lcd_RegWrite(IniReg[4],(IniData[4]&(~0x20)));
 194   1              while((*pbuf!=0)&&(maxcnt--!=0))
 195   1                      Lcd_WRData(*pbuf++);
 196   1              Lcd_RegWrite(IniReg[4],(IniData[4]|0x20));
 197   1      }
 198          //------------------------------------------------------------------------------


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    600    ----
   CONSTANT SIZE    =     80    ----
   XDATA SIZE       =   ----      10
   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 + =
减小字号Ctrl + -
显示快捷键?